0

So I've been looking around for a few days now and I can't seem to find the solution. The error only pops up when I have ProGuard enabled so I suppose it's coming from there, however I'm not sure how to change the configuration to fix the problem.

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);

Any ideas would be greatly appreciated, thanks :)

VoxFox
  • 1
  • 3
  • We surely can't help you without seeing your proguard file and knowing what your `World` code looks like. Getting stuff to work with proguards is nasty. – m02ph3u5 Jun 23 '16 at 21:34
  • Updated the post with that :) – VoxFox Jun 24 '16 at 01:44
  • Why do you have a proguard-rules.pro and proguard-project.txt file? Both can be merged into one. Are you sure that you also include the proguard-project.txt in your gradle build script? – T. Neidhart Jun 24 '16 at 07:22
  • I have `minifyEnabled true` and `proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'` Would I edit that second line if I was just using one file? – VoxFox Jun 24 '16 at 18:39
  • Official decision of LibGDX 2022: https://stackoverflow.com/a/74208660/14510925 – Владислав Шестернин Oct 26 '22 at 13:33

0 Answers0