所以我现在已经四处寻找,我似乎无法找到解决方案。当我启用ProGuard时,只会弹出错误,所以我想它是从那里出来的,但是我不知道如何更改配置来解决问题。
JNI DETECTED ERROR IN APPLICATION: JNI GetMethodID called with pending exception java.lang.NoSuchMethodError: no non-static method "Lcom/badlogic/gdx/physics/box2d/World;.beginContact(J)V"
06-23 12:05:29.625 3033-3047/? A/art: art/runtime/java_vm_ext.cc:410] at long com.badlogic.gdx.physics.box2d.World.newWorld(float, float, boolean) ((null):-2)
06-23 12:05:29.625 3033-3047/? A/art: art/runtime/java_vm_ext.cc:410] at void com.badlogic.gdx.physics.box2d.World.<init>(com.badlogic.gdx.math.n, boolean) ((null):-1) at void ca.cubiccreations.zoobreak.b.a.<init>(ca.cubiccreations.zoobreak.b) ((null):-1)
06-23 12:05:29.625 3033-3047/? A/art: art/runtime/java_vm_ext.cc:410] at void ca.cubiccreations.zoobreak.b.a() ((null):-1)
06-23 12:05:29.625 3033-3047/? A/art: art/runtime/java_vm_ext.cc:410] at void com.badlogic.gdx.backends.android.k.onSurfaceChanged(javax.microedition.khronos.opengles.GL10, int, int) ((null):-1)
06-23 12:05:29.625 3033-3047/? A/art: art/runtime/java_vm_ext.cc:410] at void android.opengl.GLSurfaceView$GLThread.guardedRun() (GLSurfaceView.java:1519)
06-23 12:05:29.625 3033-3047/? A/art: art/runtime/java_vm_ext.cc:410] at void android.opengl.GLSurfaceView$GLThread.run() (GLSurfaceView.java:1240)
proguard的-project.txt
-verbose
-dontwarn android.support.**
-dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication
-dontwarn com.badlogic.gdx.utils.GdxBuild
-dontwarn com.badlogic.gdx.physics.box2d.utils.Box2DBuild
-dontwarn com.badlogic.gdx.jnigen.BuildTarget*
-dontwarn com.badlogic.gdx.graphics.g2d.freetype.FreetypeBuild
-dontwarn com.badlogic.gdx.physics.box2d.utils.Box2DBuild
-dontwarn com.badlogic.gdx.graphics.g2d.freetype.FreeTypeBuild
-keep class com.badlogic.gdx.controllers.android.AndroidControllers
-keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* {
<init>(com.badlogic.gdx.Application, android.content.Context, java.lang.Object, com.badlogic.gdx.backends.android.AndroidApplicationConfiguration);
}
-keepclassmembers class com.badlogic.gdx.physics.box2d.World {
boolean contactFilter(long, long);
void beginContact(long);
void endContact(long);
void preSolve(long, long);
void postSolve(long, long);
boolean reportFixture(long);
float reportRayFixture(long, float, float, float, float, float);
proguard-rules.pro
-dontwarn com.badlogic.gdx.graphics.g2d.freetype.FreetypeBuild
-dontwarn com.badlogic.gdx.physics.box2d.utils.Box2DBuild
-dontwarn com.badlogic.gdx.physics.bullet.BulletBuild
-dontwarn com.badlogic.gdx.utils.GdxBuild
-keepnames class com.badlogic.gdx.backends.android.AndroidInput*
-keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* {<init>(...);}
-keep class com.badlogic.gdx.physics.box2d.B2ContactListener
-
world = new World(new Vector2(0, -9.80f), true);
非常感谢任何想法,谢谢:)