Hi again,
I'm still not able to play any Slick Animation on Android but may be someone among you will be able to reproduce the problem and hopefully will have a way to fix it.
Here is my development environment:
- Windows 7 64bits
- jdk1.6.0_24 for Windows 7 64bits
- Eclipse 3.7.0 for Windows 7 64bits
- SDK Platform Android 2.3.3 - API 10 for Any Platform
I'm also working with the latest version of Slick and Slick-AE from the SVN repository (
https://bob.newdawnsoftware.com/repos/slick/trunk) (revision 1559). I used the build.xml to generate the slick-ae.jar file so I can run without troubles the example project Slick-Android-Test.
But within that example project, if I just use the following class instead of the Puzzle one, I get the error message complaining about missing org.lwjgl.Sys class.
Code:
package animation.test;
import org.newdawn.slick.Animation;
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
public class AndroidAnimationTest extends BasicGame {
/** The images of the different kats */
private Image[] kitis = new Image[9];
/** The animation for the unstable morphing kitty */
private Animation animation;
/** The container holding the Animation Test */
private GameContainer container;
/**
* Create a new Animation Test instance
*/
public AndroidAnimationTest() {
super("Animation Test");
}
/**
* @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
*/
public void init(GameContainer container) throws SlickException {
this.container = container;
container.setShowFPS(false);
container.setVSync(true);
container.setVerbose(false);
container.setIcon("res/icon.png");
container.setMouseCursor("res/cursor.png", 5, 2);
for (int i = 0; i < kitis.length; i++) {
kitis[i] = new Image("res/" + (i + 1) + ".png");
}
animation = new Animation(kitis, 50);
}
/**
* @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
*/
public void render(GameContainer container, Graphics g) throws SlickException {
float x = 10f;
float y = 10f;
for (int i = 0; i < kitis.length; i++) {
g.drawImage(kitis[i], x, y, Color.white);
x += 10f;
}
animation.draw(50f, 50f);
}
/**
* @see org.newdawn.slick.BasicGame#update(org.newdawn.slick.GameContainer, int)
*/
public void update(GameContainer container, int delta) throws SlickException {
}
/**
* @see org.newdawn.slick.BasicGame#keyPressed(int, char)
*/
public void keyPressed(int key, char c) {
if (key == Input.KEY_ESCAPE) {
container.exit();
}
}
/**
* @see org.newdawn.slick.BasicGame#mousePressed(int, int, int)
*/
public void mousePressed(int button, int x, int y) {
}
/**
* Entry point into our game. Simple bootstrap for the container and fire
* the game off.
*
* @param argv The arguments passed into the game
*/
public static void main(String[] argv) {
try {
AppGameContainer container = new AppGameContainer(new AndroidAnimationTest());
container.start();
} catch (SlickException e) {
e.printStackTrace();
}
}
}
Off course, file SlickTestActivity.java becomes:
Code:
package org.newdawn.slick.android;
import org.newdawn.slick.SlickActivity;
import android.os.Bundle;
import animation.test.AndroidAnimationTest;
/**
* A simple test activity to show bootstrapping a Slick Game implementation
* into android.
*
* @author kevin
*/
public class SlickTestActivity extends SlickActivity {
/*
* (non-Javadoc)
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//start(new TestGDXContainer(), 800, 480);
//start(new Puzzle(), 640, 480);
start(new AndroidAnimationTest(), 640, 480);
}
}
If I just remove the line requesting to draw the animation, I get no issue and the individual images for the kitten are properly displayed.
But if I leave it like that, the android application crashes and give me the following stack trace within LogCat:
09-08 22:40:33.828: DEBUG/AndroidRuntime(384): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
09-08 22:40:33.828: DEBUG/AndroidRuntime(384): CheckJNI is ON
09-08 22:40:34.507: DEBUG/AndroidRuntime(384): Calling main entry com.android.commands.pm.Pm
09-08 22:40:34.687: DEBUG/dalvikvm(259): GC_EXPLICIT freed 3K, 54% free 2545K/5511K, external 1625K/2137K, paused 56ms
09-08 22:40:34.697: WARN/ActivityManager(60): No content provider found for:
09-08 22:40:34.907: WARN/ActivityManager(60): No content provider found for:
09-08 22:40:34.917: DEBUG/PackageParser(60): Scanning package: /data/app/vmdl752973159.tmp
09-08 22:40:35.567: INFO/PackageManager(60): Removing non-system package:org.newdawn.slick.android
09-08 22:40:35.567: INFO/ActivityManager(60): Force stopping package org.newdawn.slick.android uid=10036
09-08 22:40:35.677: DEBUG/PackageManager(60): Scanning package org.newdawn.slick.android
09-08 22:40:35.677: INFO/PackageManager(60): Package org.newdawn.slick.android codePath changed from /data/app/org.newdawn.slick.android-1.apk to /data/app/org.newdawn.slick.android-2.apk; Retaining data and using new
09-08 22:40:35.687: INFO/PackageManager(60): Unpacking native libraries for /data/app/org.newdawn.slick.android-2.apk
09-08 22:40:35.828: DEBUG/installd(34): DexInv: --- BEGIN '/data/app/org.newdawn.slick.android-2.apk' ---
09-08 22:40:38.287: DEBUG/dalvikvm(393): DexOpt: load 227ms, verify+opt 1687ms
09-08 22:40:38.347: DEBUG/installd(34): DexInv: --- END '/data/app/org.newdawn.slick.android-2.apk' (success) ---
09-08 22:40:38.347: WARN/PackageManager(60): Code path for pkg : org.newdawn.slick.android changing from /data/app/org.newdawn.slick.android-1.apk to /data/app/org.newdawn.slick.android-2.apk
09-08 22:40:38.347: WARN/PackageManager(60): Resource path for pkg : org.newdawn.slick.android changing from /data/app/org.newdawn.slick.android-1.apk to /data/app/org.newdawn.slick.android-2.apk
09-08 22:40:38.347: DEBUG/PackageManager(60): Activities: org.newdawn.slick.android.SlickTestActivity
09-08 22:40:38.367: INFO/ActivityManager(60): Force stopping package org.newdawn.slick.android uid=10036
09-08 22:40:38.498: INFO/installd(34): move /data/dalvik-cache/data@app@org.newdawn.slick.android-2.apk@classes.dex -> /data/dalvik-cache/data@app@org.newdawn.slick.android-2.apk@classes.dex
09-08 22:40:38.498: DEBUG/PackageManager(60): New package installed in /data/app/org.newdawn.slick.android-2.apk
09-08 22:40:38.637: INFO/ActivityManager(60): Force stopping package org.newdawn.slick.android uid=10036
09-08 22:40:38.727: DEBUG/dalvikvm(60): GC_EXPLICIT freed 861K, 48% free 4332K/8263K, external 3511K/3903K, paused 87ms
09-08 22:40:38.858: DEBUG/dalvikvm(186): GC_EXPLICIT freed 119K, 52% free 2756K/5703K, external 1625K/2137K, paused 96ms
09-08 22:40:38.937: WARN/RecognitionManagerService(60): no available voice recognition services found
09-08 22:40:39.207: DEBUG/dalvikvm(60): GC_EXPLICIT freed 242K, 49% free 4259K/8263K, external 3511K/3903K, paused 91ms
09-08 22:40:39.207: DEBUG/SntpClient(60): request time failed: java.net.SocketException: Address family not supported by protocol
09-08 22:40:39.207: INFO/installd(34): unlink /data/dalvik-cache/data@app@org.newdawn.slick.android-1.apk@classes.dex
09-08 22:40:39.237: DEBUG/AndroidRuntime(384): Shutting down VM
09-08 22:40:39.257: DEBUG/dalvikvm(384): GC_CONCURRENT freed 101K, 72% free 295K/1024K, external 0K/0K, paused 1ms+1ms
09-08 22:40:39.257: DEBUG/jdwp(384): Got wake-up signal, bailing out of select
09-08 22:40:39.257: DEBUG/dalvikvm(384): Debugger has detached; object registry had 1 entries
09-08 22:40:39.887: DEBUG/AndroidRuntime(398): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
09-08 22:40:39.897: DEBUG/AndroidRuntime(398): CheckJNI is ON
09-08 22:40:40.647: DEBUG/AndroidRuntime(398): Calling main entry com.android.commands.am.Am
09-08 22:40:40.687: INFO/ActivityManager(60): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=org.newdawn.slick.android/.SlickTestActivity } from pid 398
09-08 22:40:40.838: INFO/ActivityManager(60): Start proc org.newdawn.slick.android for activity org.newdawn.slick.android/.SlickTestActivity: pid=406 uid=10036 gids={}
09-08 22:40:40.847: DEBUG/AndroidRuntime(398): Shutting down VM
09-08 22:40:40.877: DEBUG/dalvikvm(398): GC_CONCURRENT freed 103K, 69% free 320K/1024K, external 0K/0K, paused 1ms+1ms
09-08 22:40:40.877: DEBUG/dalvikvm(398): Debugger has detached; object registry had 1 entries
09-08 22:40:40.917: INFO/dalvikvm(398): JNI: AttachCurrentThread (from ???.???)
09-08 22:40:40.917: INFO/AndroidRuntime(398): NOTE: attach of thread 'Binder Thread #3' failed
09-08 22:40:41.197: INFO/WindowManager(60): Setting rotation to 1, animFlags=1
09-08 22:40:41.197: INFO/ActivityManager(60): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=2 layout=34 uiMode=17 seq=9}
09-08 22:40:41.467: WARN/System.err(406): GdxNativesLoader: Couldn't unpack and load native 'libgdx.so'
09-08 22:40:41.467: DEBUG/dalvikvm(406): Trying to load lib /data/data/org.newdawn.slick.android/lib/libgdx.so 0x40515600
09-08 22:40:41.479: DEBUG/dalvikvm(406): Added shared lib /data/data/org.newdawn.slick.android/lib/libgdx.so 0x40515600
09-08 22:40:41.479: DEBUG/dalvikvm(406): No JNI_OnLoad found in /data/data/org.newdawn.slick.android/lib/libgdx.so 0x40515600, skipping init
09-08 22:40:41.507: ERROR/SLICK(406): Slick-AE 0
09-08 22:40:41.767: INFO/ActivityManager(60): Displayed org.newdawn.slick.android/.SlickTestActivity: +942ms
09-08 22:40:41.817: INFO/dalvikvm(60): Jit: resizing JitTable from 1024 to 2048
09-08 22:40:41.987: DEBUG/libEGL(406): egl.cfg not found, using default config
09-08 22:40:41.987: DEBUG/libEGL(406): loaded /system/lib/egl/libGLES_android.so
09-08 22:40:42.137: DEBUG/AndroidGraphics(406): OGL renderer: Android PixelFlinger 1.4
09-08 22:40:42.137: DEBUG/AndroidGraphics(406): OGL vendor: Android
09-08 22:40:42.137: DEBUG/AndroidGraphics(406): OGL version: OpenGL ES-CM 1.0
09-08 22:40:42.137: DEBUG/AndroidGraphics(406): OGL extensions: GL_OES_byte_coordinates GL_OES_fixed_point GL_OES_single_precision GL_OES_read_format GL_OES_compressed_paletted_texture GL_OES_draw_texture GL_OES_matrix_get GL_OES_query_matrix GL_OES_EGL_image GL_OES_compressed_ETC1_RGB8_texture GL_ARB_texture_compression GL_ARB_texture_non_power_of_two GL_ANDROID_user_clip_plane GL_ANDROID_vertex_buffer_object GL_ANDROID_generate_mipmap
09-08 22:40:42.137: DEBUG/AndroidGraphics(406): framebuffer: (5, 6, 5, 0)
09-08 22:40:42.137: DEBUG/AndroidGraphics(406): depthbuffer: (16)
09-08 22:40:42.137: DEBUG/AndroidGraphics(406): stencilbuffer: (0)
09-08 22:40:42.167: ERROR/SLICK(406): Starting display 640x480 800x480
09-08 22:40:42.167: ERROR/SLICK(406): Requesting: defaultfont.png
09-08 22:40:42.337: ERROR/SLICK(406): Requesting: defaultfont.fnt
09-08 22:40:42.337: ERROR/SLICK(406): Fail: Unsupported: glGenLists
09-08 22:40:42.558: WARN/IInputConnectionWrapper(135): showStatusIcon on inactive InputConnection
09-08 22:40:42.737: ERROR/SLICK(406): Creating application: org.newdawn.slick.android.SlickTestActivity@4051d020
09-08 22:40:42.747: ERROR/SLICK(406): Requesting: res/1.png
09-08 22:40:42.797: ERROR/SLICK(406): Requesting: res/2.png
09-08 22:40:42.857: ERROR/SLICK(406): Requesting: res/3.png
09-08 22:40:42.898: ERROR/SLICK(406): Requesting: res/4.png
09-08 22:40:42.947: ERROR/SLICK(406): Requesting: res/5.png
09-08 22:40:43.027: DEBUG/dalvikvm(406): GC_EXTERNAL_ALLOC freed 410K, 50% free 3107K/6151K, external 2121K/2137K, paused 72ms
09-08 22:40:43.067: ERROR/SLICK(406): Requesting: res/6.png
09-08 22:40:43.117: ERROR/SLICK(406): Requesting: res/7.png
09-08 22:40:43.157: ERROR/SLICK(406): Requesting: res/8.png
09-08 22:40:43.197: ERROR/SLICK(406): Requesting: res/9.png
09-08 22:40:43.257: INFO/dalvikvm(406):
Could not find method org.lwjgl.Sys.getTime, referenced from method org.newdawn.slick.Animation.getTime
09-08 22:40:43.257: WARN/dalvikvm(406): VFY: unable to resolve static method 5193: Lorg/lwjgl/Sys;.getTime ()J
09-08 22:40:43.257: DEBUG/dalvikvm(406): VFY: replacing opcode 0x71 at 0x0000
09-08 22:40:43.257: DEBUG/dalvikvm(406): VFY: dead code 0x0003-000c in Lorg/newdawn/slick/Animation;.getTime ()J
09-08 22:40:43.307: INFO/ARMAssembler(406): generated scanline__00000177:03545444_00009501_00000000 [160 ipp] (216 ins) at [0x446e61e8:0x446e6548] in 2419349 ns
09-08 22:40:43.327: ERROR/SLICK(406): java.lang.NoClassDefFoundError: org.lwjgl.Sys
09-08 22:40:43.327: ERROR/SLICK(406): at org.newdawn.slick.Animation.getTime(Animation.java:603)
09-08 22:40:43.327: ERROR/SLICK(406): at org.newdawn.slick.Animation.draw(Animation.java:367)
09-08 22:40:43.327: ERROR/SLICK(406): at org.newdawn.slick.Animation.draw(Animation.java:349)
09-08 22:40:43.327: ERROR/SLICK(406): at org.newdawn.slick.Animation.draw(Animation.java:326)
09-08 22:40:43.327: ERROR/SLICK(406): at animation.test.AndroidAnimationTest.render(AndroidAnimationTest.java:61)
09-08 22:40:43.327: ERROR/SLICK(406): at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:541)
09-08 22:40:43.327: ERROR/SLICK(406): at org.newdawn.slick.GDXGameContainer.render(GDXGameContainer.java:156)
09-08 22:40:43.327: ERROR/SLICK(406): at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(Unknown Source)
09-08 22:40:43.327: ERROR/SLICK(406): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1363)
09-08 22:40:43.327: ERROR/SLICK(406): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
09-08 22:40:43.337: ERROR/SLICK(406): Failed to render/update
09-08 22:40:43.337: ERROR/SLICK(406): org.newdawn.slick.SlickException: Game.render() failure - check the game code.
09-08 22:40:43.337: ERROR/SLICK(406): at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:544)
09-08 22:40:43.337: ERROR/SLICK(406): at org.newdawn.slick.GDXGameContainer.render(GDXGameContainer.java:156)
09-08 22:40:43.337: ERROR/SLICK(406): at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(Unknown Source)
09-08 22:40:43.337: ERROR/SLICK(406): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1363)
09-08 22:40:43.337: ERROR/SLICK(406): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
09-08 22:40:43.367: WARN/dalvikvm(406): threadid=9: thread exiting with uncaught exception (group=0x40015560)
09-08 22:40:43.367: ERROR/AndroidRuntime(406): FATAL EXCEPTION: GLThread 10
09-08 22:40:43.367: ERROR/AndroidRuntime(406): java.lang.RuntimeException: org.newdawn.slick.SlickException: Game.render() failure - check the game code.
09-08 22:40:43.367: ERROR/AndroidRuntime(406): at org.newdawn.slick.GDXGameContainer.render(GDXGameContainer.java:160)
09-08 22:40:43.367: ERROR/AndroidRuntime(406): at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(Unknown Source)
09-08 22:40:43.367: ERROR/AndroidRuntime(406): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1363)
09-08 22:40:43.367: ERROR/AndroidRuntime(406): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
09-08 22:40:43.367: ERROR/AndroidRuntime(406): Caused by: org.newdawn.slick.SlickException: Game.render() failure - check the game code.
09-08 22:40:43.367: ERROR/AndroidRuntime(406): at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:544)
09-08 22:40:43.367: ERROR/AndroidRuntime(406): at org.newdawn.slick.GDXGameContainer.render(GDXGameContainer.java:156)
09-08 22:40:43.367: ERROR/AndroidRuntime(406): ... 3 more
09-08 22:40:43.427: WARN/ActivityManager(60): Force finishing activity org.newdawn.slick.android/.SlickTestActivity
09-08 22:40:43.649: DEBUG/dalvikvm(60): GC_EXTERNAL_ALLOC freed 95K, 49% free 4274K/8263K, external 3897K/3903K, paused 73ms
09-08 22:40:43.938: WARN/ActivityManager(60): Activity pause timeout for HistoryRecord{4050ac08 org.newdawn.slick.android/.SlickTestActivity}
09-08 22:40:44.188: DEBUG/dalvikvm(60): GC_EXPLICIT freed 11K, 49% free 4274K/8263K, external 3906K/4878K, paused 234ms
09-08 22:40:44.198: INFO/WindowManager(60): Setting rotation to 0, animFlags=1
09-08 22:40:44.228: INFO/ActivityManager(60): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=1 layout=34 uiMode=17 seq=10}
09-08 22:40:47.088: DEBUG/dalvikvm(60): GC_EXPLICIT freed 12K, 49% free 4274K/8263K, external 3897K/4867K, paused 74ms
09-08 22:40:50.358: DEBUG/dalvikvm(240): GC_EXPLICIT freed 11K, 55% free 2596K/5703K, external 1625K/2137K, paused 50ms
09-08 22:40:54.469: WARN/ActivityManager(60): Activity destroy timeout for HistoryRecord{4050ac08 org.newdawn.slick.android/.SlickTestActivity}
09-08 22:40:55.437: DEBUG/dalvikvm(259): GC_EXPLICIT freed 8K, 54% free 2544K/5511K, external 1625K/2137K, paused 83ms
09-08 22:41:05.128: DEBUG/dalvikvm(311): GC_EXPLICIT freed 4K, 54% free 2538K/5511K, external 1625K/2137K, paused 44ms
09-08 22:41:06.038: INFO/Process(406): Sending signal. PID: 406 SIG: 9
09-08 22:41:06.408: INFO/ActivityManager(60): Process org.newdawn.slick.android (pid 406) has died.
09-08 22:41:06.408: INFO/WindowManager(60): WIN DEATH: Window{40608d00 SurfaceView paused=false}
09-08 22:41:06.428: ERROR/InputDispatcher(60): channel '40767d20 org.newdawn.slick.android/org.newdawn.slick.android.SlickTestActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
09-08 22:41:06.428: ERROR/InputDispatcher(60): channel '40767d20 org.newdawn.slick.android/org.newdawn.slick.android.SlickTestActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
09-08 22:41:06.468: INFO/WindowManager(60): WIN DEATH: Window{40767d20 org.newdawn.slick.android/org.newdawn.slick.android.SlickTestActivity paused=false}
Could anybody please try to test that on his side and tell me if it works?
Edit:
The more I look into it, the more I think that we need to include more of the lwjgl classes into Slick-AE. I actually just tried to add Sys.java into slick/Slick-AE/src/org/lwjgl directory and rebuilt slick-ae.jar and now I get
java.lang.NoClassDefFoundError: org.lwjgl.LWJGLUtil.
Thank you very much,
Makenshi