AndEngine doesn't work on Motorola Defy

I'm now testing an app I'm wokring on, on various devices and unfortunately a problem I'm encountering is that for some reason any AndEngine activity I tried to run on a Motorola Defy device with Android 2.2.2 doesn't work and crashes the app.

On the other devices I tested these AndEngine activities such as Samsung Galaxy S2 and Samsung Galaxy Mini everything worked flawlessly.

(I'm using AndEngine with GLES2)

The error I'm receiving is this

06-02 13:46:12.749: E/AndroidRuntime(3318): FATAL EXCEPTION: GLThread 21
06-02 13:46:12.749: E/AndroidRuntime(3318): java.lang.ExceptionInInitializerError
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.opengl.vbo.attribute.VertexBufferObjectAttributeFix.glVertexAttribPointer(VertexBufferObjectAttributeFix.java:39)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.opengl.vbo.attribute.VertexBufferObjectAttributes.glVertexAttribPointers(VertexBufferObjectAttributes.java:50)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.opengl.shader.ShaderProgram.bind(ShaderProgram.java:126)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.opengl.shader.PositionColorTextureCoordinatesShaderProgram.bind(PositionColorTextureCoordinatesShaderProgram.java:89)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.opengl.vbo.VertexBufferObject.bind(VertexBufferObject.java:160)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.entity.sprite.Sprite.preDraw(Sprite.java:170)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.entity.Entity.onManagedDraw(Entity.java:1266)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.entity.Entity.onDraw(Entity.java:1072)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.entity.Entity.onManagedDraw(Entity.java:1295)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.entity.scene.Scene.onManagedDraw(Scene.java:261)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.entity.Entity.onDraw(Entity.java:1072)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.engine.Engine.onDrawScene(Engine.java:623)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.engine.Engine.onDrawFrame(Engine.java:613)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.opengl.view.EngineRenderer.onDrawFrame(EngineRenderer.java:104)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1332)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)
06-02 13:46:12.749: E/AndroidRuntime(3318): Caused by: org.andengine.util.exception.AndEngineRuntimeException: java.lang.UnsatisfiedLinkError: Library andengine not found
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.opengl.GLES20Fix.<clinit>(GLES20Fix.java:22)
06-02 13:46:12.749: E/AndroidRuntime(3318):     ... 16 more
06-02 13:46:12.749: E/AndroidRuntime(3318): Caused by: java.lang.UnsatisfiedLinkError: Library andengine not found
06-02 13:46:12.749: E/AndroidRuntime(3318):     at java.lang.Runtime.loadLibrary(Runtime.java:461)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at java.lang.System.loadLibrary(System.java:557)
06-02 13:46:12.749: E/AndroidRuntime(3318):     at org.andengine.opengl.GLES20Fix.<clinit>(GLES20Fix.java:20)
06-02 13:46:12.749: E/AndroidRuntime(3318):     ... 16 more

To me it seems as there's a real problem with running AndEngine's infrastructure for some reason, and not like its a problem with my code.

Even the most simple andengine acitivities with just a single simple sprite crash.

I hope there's a reasonable solution to this problem.

Thanks!

EDIT:

As Nicolas suggested I debugged the AndEngine.isDeviceSupported method, and the exception was thrown on this line

System.loadLibrary("andengine");

in this method

private static void checkCodePathSupport() throws DeviceNotSupportedException {
        if(SystemUtils.isAndroidVersionOrLower(Build.VERSION_CODES.FROYO)) {
            try {
                System.loadLibrary("andengine");
            } catch (final UnsatisfiedLinkError e) {
                throw new DeviceNotSupportedException(DeviceNotSupportedCause.CODEPATH_INCOMPLETE, e);
            }
        }
    }

The exception is UnsatisfiedLinkError: Library andengine not found.

I hope this helps..


As seen here: https://github.com/nicolasgramlich/AndEngineExamples/blob/GLES2/src/org/andengine/examples/launcher/ExampleLauncher.java#L61

Call:

if(!AndEngine.isDeviceSupported()) {
    // Oh no
}

If that method doesn't exist in your code yet, update to the latest GLES2 revision.

Report back where exactly it fails.

Thanks. =)


I got to test it on a new Motorola Defy Plus with gingerbread version and it worked. So either the old android version was not supported (2.2) or the older regular Motorola Defy's hardware was not supported.

链接地址: http://www.djcxy.com/p/36746.html

上一篇: ImageView在摩托罗拉Defy上是黑色的

下一篇: AndEngine不适用于摩托罗拉Defy