我现在正在各种设备上测试我正在使用的应用程序,不幸的是我遇到的一个问题是,由于某种原因,我尝试在装有 Android 2.2.2 的摩托罗拉 Defy 设备上运行的任何 AndEngine 活动都不起作用并使应用程序崩溃。
在其他设备上,我测试了这些 AndEngine 活动,例如三星 Galaxy S2 和三星 Galaxy Mini,一切正常。
(我将 AndEngine 与 GLES2 一起使用)
我收到的错误是这个
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
对我来说,出于某种原因,运行 AndEngine 的基础设施似乎存在真正的问题,而不是我的代码存在问题。
即使是最简单的引擎活动也只需一个简单的精灵崩溃。
我希望有一个合理的解决方案来解决这个问题。
谢谢!
编辑:
正如 Nicolas 建议的那样,我调试了 AndEngine.isDeviceSupported 方法,并在这一行抛出了异常
System.loadLibrary("andengine");
在这个方法中
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);
}
}
}
例外是 UnsatisfiedLinkError: Library andengine not found。
我希望这有帮助..