Libgdx bulletwrapper 应用程序在使用混淆器时崩溃
Libgdx bulletwrapper app crashes when using proguard
我的 libgdx/bullet 应用程序在我尝试 运行 一个启用了 proguard 的发布 apk 时崩溃并出现以下异常:
Process: com.my.app, PID: 14042
java.lang.NoSuchMethodError: no static method "Lcom/badlogic/gdx/physics/bullet/linearmath/LinearMathJNI;.SwigDirector_btIDebugDraw_getDefaultColors(Lcom/badlogic/gdx/physics/bullet/linearmath/btIDebugDraw;)J"
at com.badlogic.gdx.physics.bullet.linearmath.LinearMathJNI.swig_module_init(Native Method)
at com.badlogic.gdx.physics.bullet.linearmath.LinearMathJNI.<clinit>(Unknown Source)
at com.badlogic.gdx.physics.bullet.linearmath.LinearMathJNI.btGetVersion(Native Method)
at com.badlogic.gdx.physics.bullet.linearmath.a.a(Unknown Source)
at com.badlogic.gdx.physics.bullet.a.a(Unknown Source)
at com.my.app.i.<init>(Unknown Source)
at com.my.app.h.a(Unknown Source)
at com.badlogic.gdx.f.a.b.b.a(Unknown Source)
at com.badlogic.gdx.f.a.b.a(Unknown Source)
at com.badlogic.gdx.f.a.b.a(Unknown Source)
at com.badlogic.gdx.f.a.a.a.a(Unknown Source)
at com.badlogic.gdx.f.a.a.a.a(Unknown Source)
at com.badlogic.gdx.f.a.b.c.a(Unknown Source)
at com.badlogic.gdx.f.a.g.a(Unknown Source)
at com.badlogic.gdx.f.a.h.b(Unknown Source)
at com.badlogic.gdx.backends.android.i.onDrawFrame(Unknown Source)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1548)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1259)
我的应用程序是一款游戏,崩溃仅在游戏屏幕开始时发生,而不是在初始菜单屏幕中。这是我的 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.jnigen.*
-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 混淆子弹调用,但不知道该怎么做。
-keep class com.badlogic.** { *; }
-keep enum com.badlogic.** { *; }
来源:this gradle file.
我也舍不得那么多-dontwarn
。应用以上内容后,看看是否可以删除它们。仅当您知道这确实不是问题并且已用尽其他方法修复警告时 -dontwarn
。
我的 libgdx/bullet 应用程序在我尝试 运行 一个启用了 proguard 的发布 apk 时崩溃并出现以下异常:
Process: com.my.app, PID: 14042
java.lang.NoSuchMethodError: no static method "Lcom/badlogic/gdx/physics/bullet/linearmath/LinearMathJNI;.SwigDirector_btIDebugDraw_getDefaultColors(Lcom/badlogic/gdx/physics/bullet/linearmath/btIDebugDraw;)J"
at com.badlogic.gdx.physics.bullet.linearmath.LinearMathJNI.swig_module_init(Native Method)
at com.badlogic.gdx.physics.bullet.linearmath.LinearMathJNI.<clinit>(Unknown Source)
at com.badlogic.gdx.physics.bullet.linearmath.LinearMathJNI.btGetVersion(Native Method)
at com.badlogic.gdx.physics.bullet.linearmath.a.a(Unknown Source)
at com.badlogic.gdx.physics.bullet.a.a(Unknown Source)
at com.my.app.i.<init>(Unknown Source)
at com.my.app.h.a(Unknown Source)
at com.badlogic.gdx.f.a.b.b.a(Unknown Source)
at com.badlogic.gdx.f.a.b.a(Unknown Source)
at com.badlogic.gdx.f.a.b.a(Unknown Source)
at com.badlogic.gdx.f.a.a.a.a(Unknown Source)
at com.badlogic.gdx.f.a.a.a.a(Unknown Source)
at com.badlogic.gdx.f.a.b.c.a(Unknown Source)
at com.badlogic.gdx.f.a.g.a(Unknown Source)
at com.badlogic.gdx.f.a.h.b(Unknown Source)
at com.badlogic.gdx.backends.android.i.onDrawFrame(Unknown Source)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1548)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1259)
我的应用程序是一款游戏,崩溃仅在游戏屏幕开始时发生,而不是在初始菜单屏幕中。这是我的 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.jnigen.*
-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 混淆子弹调用,但不知道该怎么做。
-keep class com.badlogic.** { *; }
-keep enum com.badlogic.** { *; }
来源:this gradle file.
我也舍不得那么多-dontwarn
。应用以上内容后,看看是否可以删除它们。仅当您知道这确实不是问题并且已用尽其他方法修复警告时 -dontwarn
。