Slick Forums

Discuss the Slick 2D Library
It is currently Mon Apr 21, 2014 4:32 am

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: demo project
PostPosted: Thu Aug 25, 2011 3:15 am 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
Here's an example set of projects for anyone who wants to see them.

http://dl.dropbox.com/u/5171811/Slick-Android-Demo.zip

you can also get an updated version from github at https://github.com/Kenkron/Bounce-Anator


Last edited by Mr. Kenkron on Sun Jan 29, 2012 11:28 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: demo project
PostPosted: Sat Jan 28, 2012 7:14 pm 
Offline

Joined: Wed Feb 02, 2011 12:21 am
Posts: 12
Just tried this building to the default Android 1.6 target that was part of the project in the .zip and it doesn't work. Slick2D desktop launcher works fine - Android just launches into a black screen. Anything I'm missing here? I'm pretty used to Android game dev but not using Slick2D with Android =(.


Top
 Profile  
 
 Post subject: Re: demo project
PostPosted: Sat Jan 28, 2012 7:25 pm 
Offline

Joined: Wed Feb 02, 2011 12:21 am
Posts: 12
ok - I guess I posted too soon. I was using a 'High Resolution' phone emulator for my original test. When I changed it to a 'Medium' phone resolution emulator it worked. I guess it's very specific when it comes to the specified resolution.

Thanks for the example project. It's helpful!


Top
 Profile  
 
 Post subject: Re: demo project
PostPosted: Sun Jan 29, 2012 1:32 am 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
if you look up bounceanator on github, you can download a version that uses android 2.1. what was the resolution you were trying to run it on? If a large resolution broke the code, there's a problem.

_________________
"Artificial intelligence will never be a match for human stupidity" - "Jamos Kennedynos"


Top
 Profile  
 
 Post subject: Re: demo project
PostPosted: Sat Mar 03, 2012 11:45 am 
Offline
User avatar

Joined: Thu Apr 24, 2008 4:28 pm
Posts: 66
Location: Germany
Also tried your Bounce-Anator demo project. Desktop version starts and shows the start screen. Good idea to add a ApplicationGDXContainer to use libgdx as backend for android testing. Unfortunately this container doesn't recognize my mouse input -can't click the start button.
The Andoid version runs good after solving one problem:
You set
android.library=true in the default.properties to true. With this flag I can't start the Android app. Changing it with Eclipse in: Project/Properties/Android/Library/Is Library wasn't possible, so I had to do it direct in the properties file.

_________________
XSwing Plus
German Java gaming Slick Tutorial


Top
 Profile  
 
 Post subject: Re: demo project
PostPosted: Sat Mar 03, 2012 8:39 pm 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
Hey Tobse, thanks for the feedback. Kevglass was the one who created the ApplicationGDXContainer. I've tested this project on a few computers and several android devices without running into a problem with recieving input. Do you know why the start button didn't work?

Also, thanks for the tip about the isLibrary flag. I had run into the problem before, but I assumed it was a problem I created outside of the repository (I develop off of a usb chip, and sometime things don't act right). I'll fix this by the end of Monday (3/5/2012).

_________________
"Artificial intelligence will never be a match for human stupidity" - "Jamos Kennedynos"


Top
 Profile  
 
 Post subject: Re: demo project
PostPosted: Sat Mar 03, 2012 8:58 pm 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
I think I have the android project fixed. Let me know if you find the cause of the input failure. Mind, I have only tested the project on windows.

Thanks again.

_________________
"Artificial intelligence will never be a match for human stupidity" - "Jamos Kennedynos"


Top
 Profile  
 
 Post subject: Re: demo project
PostPosted: Sun Aug 12, 2012 3:10 pm 
Offline

Joined: Mon Apr 02, 2012 7:04 am
Posts: 8
Location: right now on Earth
Hi there, I am struggling with Slick AE, Eclipse and the Emulator.
I really followed the tutorial http://slick.cokeandcode.com/wiki/doku. ... unceanator but is not enought or it changed in a certain way with the version of the Emulator.

So I have problem about the fact it does not find my main class (Main0001a()) located in the normal slick project that works when I execute it. Of course, everything is compiling, means that the normal slick project is set in class path of the android project.

Code:
package com.atalante.droid;
import org.newdawn.slick.SlickActivity;
import android.os.Bundle;
import com.atalante.droid.Main0001a;

public class MainActivity extends SlickActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        start(new Main0001a(),480,800);
    }
}

It compiled but failed with this exception (the package is installed in the emulator but failed when it starts) : Could not find class 'com.atalante.droid.Main0001a'
Code:
08-12 14:27:31.140: E/Trace(687): error opening trace file: No such file or directory (2)
08-12 14:27:31.410: E/dalvikvm(687): Could not find class 'com.atalante.droid.Main0001a', referenced from method com.rob.MainActivity.onCreate
08-12 14:27:31.430: W/dalvikvm(687): VFY: unable to resolve new-instance 65 (Lcom/atalante/droid/Main0001a;) in Lcom/rob/MainActivity;
08-12 14:27:31.460: D/dalvikvm(687): VFY: replacing opcode 0x22 at 0x0003
08-12 14:27:31.460: D/dalvikvm(687): DexOpt: unable to opt direct call 0x008c at 0x05 in Lcom/rob/MainActivity;.onCreate
08-12 14:27:31.510: W/System.err(687): GdxNativesLoader: Couldn't unpack and load native 'libgdx.so'
08-12 14:27:31.530: D/dalvikvm(687): Trying to load lib /data/data/com.rob/lib/libgdx.so 0x411e1140
08-12 14:27:31.550: D/dalvikvm(687): Added shared lib /data/data/com.rob/lib/libgdx.so 0x411e1140
08-12 14:27:31.550: D/dalvikvm(687): No JNI_OnLoad found in /data/data/com.rob/lib/libgdx.so 0x411e1140, skipping init
08-12 14:27:31.560: E/SLICK(687): Slick-AE 0
08-12 14:27:31.641: D/dalvikvm(687): GC_CONCURRENT freed 56K, 2% free 8367K/8519K, paused 18ms+3ms, total 74ms
08-12 14:27:31.641: D/dalvikvm(687): WAIT_FOR_CONCURRENT_GC blocked 56ms
08-12 14:27:31.650: D/AndroidRuntime(687): Shutting down VM
08-12 14:27:31.650: W/dalvikvm(687): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
08-12 14:27:31.660: E/AndroidRuntime(687): FATAL EXCEPTION: main
08-12 14:27:31.660: E/AndroidRuntime(687):java.lang.NoClassDefFoundError: com.atalante.droid.Main0001a
08-12 14:27:31.660: E/AndroidRuntime(687):    at com.rob.MainActivity.onCreate(MainActivity.java:14)
08-12 14:27:31.660: E/AndroidRuntime(687):    at android.app.Activity.performCreate(Activity.java:5008)
08-12 14:27:31.660: E/AndroidRuntime(687):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
08-12 14:27:31.660: E/AndroidRuntime(687):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
08-12 14:27:31.660: E/AndroidRuntime(687):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
08-12 14:27:31.660: E/AndroidRuntime(687):    at android.app.ActivityThread.access$600(ActivityThread.java:130)
08-12 14:27:31.660: E/AndroidRuntime(687):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
08-12 14:27:31.660: E/AndroidRuntime(687):    at android.os.Handler.dispatchMessage(Handler.java:99)
08-12 14:27:31.660: E/AndroidRuntime(687):    at android.os.Looper.loop(Looper.java:137)
08-12 14:27:31.660: E/AndroidRuntime(687):    at android.app.ActivityThread.main(ActivityThread.java:4745)
08-12 14:27:31.660: E/AndroidRuntime(687):    at java.lang.reflect.Method.invokeNative(Native Method)
08-12 14:27:31.660: E/AndroidRuntime(687):    at java.lang.reflect.Method.invoke(Method.java:511)
08-12 14:27:31.660: E/AndroidRuntime(687):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
08-12 14:27:31.660: E/AndroidRuntime(687):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-12 14:27:31.660: E/AndroidRuntime(687):    at dalvik.system.NativeStart.main(Native Method)


the Main0001a().class is like this :
Code:
package com.atalante.droid;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;
import org.newdawn.slick.state.transition.FadeInTransition;


public class Main0001a extends StateBasedGame {
   
   public Main0001a() {
      super("Test");
      this.addState(new TestScreenLite());
      this.enterState(GameStates.LITE.getId(), null, new FadeInTransition());
   }

   @Override
   public void initStatesList(GameContainer container) throws SlickException {
   }
   
    public static void main(String[] argv) {
        try {
            AppGameContainer container = new AppGameContainer(new Main0001a());
            container.setDisplayMode(1024,768,false);
            container.start();             
        } catch (SlickException e) {
            e.printStackTrace();
        }
    }
 
}


and TestScreenLite extends BasicGameState.
The only 'important' code is this one (it is a super simple class as you can see):
Code:
public void render(GameContainer container, StateBasedGame game, Graphics g)
         throws SlickException {
      g.drawString("hello", 0,0);
   }


I even tried to put directly the jar of my normal project into the android one, but I have still the same error.

So I tried to make the Slick-AEDemo and it works when it is the desktop version launched. (this version is implementing the ApplicationGDXContainer)
Now when I tried to launch the version Slick-AEDemo-Android same error ...

Code:
08-12 14:41:20.800: E/AndroidRuntime(727): FATAL EXCEPTION: main
08-12 14:41:20.800: E/AndroidRuntime(727): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{test.slick.bounceanate/test.slick.bounceanate.BounceAnatorAndroid}: java.lang.ClassNotFoundException: test.slick.bounceanate.BounceAnatorAndroid
08-12 14:41:20.800: E/AndroidRuntime(727):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
08-12 14:41:20.800: E/AndroidRuntime(727):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
08-12 14:41:20.800: E/AndroidRuntime(727):    at android.app.ActivityThread.access$600(ActivityThread.java:130)
08-12 14:41:20.800: E/AndroidRuntime(727):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
08-12 14:41:20.800: E/AndroidRuntime(727):    at android.os.Handler.dispatchMessage(Handler.java:99)
08-12 14:41:20.800: E/AndroidRuntime(727):    at android.os.Looper.loop(Looper.java:137)
08-12 14:41:20.800: E/AndroidRuntime(727):    at android.app.ActivityThread.main(ActivityThread.java:4745)
08-12 14:41:20.800: E/AndroidRuntime(727):    at java.lang.reflect.Method.invokeNative(Native Method)
08-12 14:41:20.800: E/AndroidRuntime(727):    at java.lang.reflect.Method.invoke(Method.java:511)
08-12 14:41:20.800: E/AndroidRuntime(727):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
08-12 14:41:20.800: E/AndroidRuntime(727):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-12 14:41:20.800: E/AndroidRuntime(727):    at dalvik.system.NativeStart.main(Native Method)
08-12 14:41:20.800: E/AndroidRuntime(727): Caused by: java.lang.ClassNotFoundException: test.slick.bounceanate.BounceAnatorAndroid
08-12 14:41:20.800: E/AndroidRuntime(727):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
08-12 14:41:20.800: E/AndroidRuntime(727):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
08-12 14:41:20.800: E/AndroidRuntime(727):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
08-12 14:41:20.800: E/AndroidRuntime(727):    at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
08-12 14:41:20.800: E/AndroidRuntime(727):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
08-12 14:41:20.800: E/AndroidRuntime(727):    ... 11 more


WTF I am doing wrong?
I changed this in the project.properties
target=android-16
then
target=android-7
then
target=android-4
(with the corresponding API for the Emulator) and got same bad luck. I am sure it is something simple ... but what?

Code:
08-12 15:08:13.027: I/jdwp(213): received file descriptor 10 from ADB
08-12 15:08:13.047: D/ddm-heap(213): Got feature list request
08-12 15:08:13.227: E/dalvikvm(213): Could not find class 'bounceAnator.BounceAnator', referenced from method test.slick.bounceanate.BounceAnatorAndroid.onCreate
08-12 15:08:13.227: W/dalvikvm(213): VFY: unable to resolve new-instance 65 (LbounceAnator/BounceAnator;) in Ltest/slick/bounceanate/BounceAnatorAndroid;
08-12 15:08:13.227: W/dalvikvm(213): VFY:  rejecting opcode 0x22 at 0x0003
08-12 15:08:13.227: W/dalvikvm(213): VFY:  rejected Ltest/slick/bounceanate/BounceAnatorAndroid;.onCreate (Landroid/os/Bundle;)V
08-12 15:08:13.227: W/dalvikvm(213): Verifier rejected class Ltest/slick/bounceanate/BounceAnatorAndroid;
08-12 15:08:13.227: W/dalvikvm(213): Class init failed in newInstance call (Ltest/slick/bounceanate/BounceAnatorAndroid;)
08-12 15:08:13.227: D/AndroidRuntime(213): Shutting down VM
08-12 15:08:13.227: W/dalvikvm(213): threadid=3: thread exiting with uncaught exception (group=0x4001aa28)
08-12 15:08:13.227: E/AndroidRuntime(213): Uncaught handler: thread main exiting due to uncaught exception
08-12 15:08:13.227: E/AndroidRuntime(213): java.lang.VerifyError: test.slick.bounceanate.BounceAnatorAndroid
08-12 15:08:13.227: E/AndroidRuntime(213):    at java.lang.Class.newInstanceImpl(Native Method)
08-12 15:08:13.227: E/AndroidRuntime(213):    at java.lang.Class.newInstance(Class.java:1472)
08-12 15:08:13.227: E/AndroidRuntime(213):    at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
08-12 15:08:13.227: E/AndroidRuntime(213):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
08-12 15:08:13.227: E/AndroidRuntime(213):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
08-12 15:08:13.227: E/AndroidRuntime(213):    at android.app.ActivityThread.access$2100(ActivityThread.java:116)
08-12 15:08:13.227: E/AndroidRuntime(213):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
08-12 15:08:13.227: E/AndroidRuntime(213):    at android.os.Handler.dispatchMessage(Handler.java:99)
08-12 15:08:13.227: E/AndroidRuntime(213):    at android.os.Looper.loop(Looper.java:123)
08-12 15:08:13.227: E/AndroidRuntime(213):    at android.app.ActivityThread.main(ActivityThread.java:4203)
08-12 15:08:13.227: E/AndroidRuntime(213):    at java.lang.reflect.Method.invokeNative(Native Method)
08-12 15:08:13.227: E/AndroidRuntime(213):    at java.lang.reflect.Method.invoke(Method.java:521)
08-12 15:08:13.227: E/AndroidRuntime(213):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
08-12 15:08:13.227: E/AndroidRuntime(213):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
08-12 15:08:13.227: E/AndroidRuntime(213):    at dalvik.system.NativeStart.main(Native Method)
08-12 15:08:13.257: I/dalvikvm(213): threadid=7: reacting to signal 3
08-12 15:08:13.257: E/dalvikvm(213): Unable to open stack trace file '/data/anr/traces.txt': Permission denied


A remark : I am working on windows 64 ... does it can make a such pb?


Top
 Profile  
 
 Post subject: Re: demo project
PostPosted: Mon Aug 13, 2012 9:35 am 
Offline
Regular

Joined: Thu Sep 22, 2011 4:39 pm
Posts: 165
Location: Belgium
are you sure in your android launch descriptor is pointing the the right package?
and that your files / jar are included?
test/slick/bounceanate/BounceAnatorAndroid vs bounceAnator.BounceAnator ?


Top
 Profile  
 
 Post subject: Re: demo project
PostPosted: Mon Aug 13, 2012 10:19 am 
Offline

Joined: Mon Apr 02, 2012 7:04 am
Posts: 8
Location: right now on Earth
Thanks for your reply.
Tonight, I will have a new (fresh) look again, because I think a step was incorrectly done - it seems to be 3 projects, not two as described in the Tutorial.
When I will succeed to make it work, maybe I will post a procedure that will detail it in "a noob way" because obviously I was confused by the explanations ... :mrgreen:


Top
 Profile  
 
 Post subject: Re: demo project
PostPosted: Tue Aug 14, 2012 6:12 am 
Offline
Regular

Joined: Thu Sep 22, 2011 4:39 pm
Posts: 165
Location: Belgium
no victory yet ? :) or was it a long night :)

this is how i see it
1 - native desktop slick project without anything related to android stuff
2 - desktop slick project but running on the slick ae jar implementing the gdx context using the android sdk
3 - android wrapper project which only includes the jar file of the second project

so you don't mix up envirionments and jar stuff


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group