Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Can't use bullet physics #3

Closed
KonstantTom opened this issue Oct 14, 2015 · 9 comments
Closed

[Android] Can't use bullet physics #3

KonstantTom opened this issue Oct 14, 2015 · 9 comments

Comments

@KonstantTom
Copy link

Hello! Bullet physics works successfully on desktop build, but it crashes on android in Bullet.init() .
For test I add 2 lines to demo:

import com.badlogic.gdx.physics.bullet.Bullet
...
override def create() {
    Bullet init ()
    ...
}

And in android build I recieve this stacktrace:

10-14 15:05:43.211: E/AndroidRuntime(8109): FATAL EXCEPTION: GLThread 681
10-14 15:05:43.211: E/AndroidRuntime(8109): Process: gdx.scala.demo.android, PID: 8109
10-14 15:05:43.211: E/AndroidRuntime(8109): java.lang.NoSuchMethodError: no static method with name='SwigDirector_btIDebugDraw_drawLine__SWIG_0' signature='(Lcom/badlogic/gdx/physics/bullet/linearmath/btIDebugDraw;Lcom/badlogic/gdx/math/Vector3;Lcom/badlogic/gdx/math/Vector3;Lcom/badlogic/gdx/math/Vector3;)V' in class Lcom/badlogic/gdx/physics/bullet/linearmath/LinearMathJNI;
10-14 15:05:43.211: E/AndroidRuntime(8109):     at com.badlogic.gdx.physics.bullet.linearmath.LinearMathJNI.swig_module_init(Native Method)
10-14 15:05:43.211: E/AndroidRuntime(8109):     at com.badlogic.gdx.physics.bullet.linearmath.LinearMathJNI.<clinit>(Unknown Source)
10-14 15:05:43.211: E/AndroidRuntime(8109):     at com.badlogic.gdx.physics.bullet.linearmath.a.a(Unknown Source)
10-14 15:05:43.211: E/AndroidRuntime(8109):     at com.badlogic.gdx.physics.bullet.a.a(Unknown Source)
10-14 15:05:43.211: E/AndroidRuntime(8109):     at gdx.scala.demo.a.a(Unknown Source)
10-14 15:05:43.211: E/AndroidRuntime(8109):     at com.badlogic.gdx.backends.android.h.onSurfaceChanged(Unknown Source)
10-14 15:05:43.211: E/AndroidRuntime(8109):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1512)
10-14 15:05:43.211: E/AndroidRuntime(8109):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

Android app build from gradle command line using android:build. I think, proguard rename some classes, but I don't know, how fix it. Help, please.

@photex
Copy link
Contributor

photex commented Oct 14, 2015

Hi @KonstantTom I'll take a look and see if there isn't something obvious.

@KonstantTom
Copy link
Author

Hi @photex !
This code in proguard-project.txt doesn't solve problem: :(

-keep public class com.badlogic.gdx.physics.bullet.** {
  *;
}

@KonstantTom
Copy link
Author

No news about this issue?
This proguard code doesn't help: :(

-keepclassmembers class com.badlogic.gdx.physics.bullet.** {
    *;
}

-keep class com.badlogic.gdx.physics.bullet.**

Full decoded stacktrace:

10-16 20:08:27.783: E/AndroidRuntime(4714): FATAL EXCEPTION: GLThread 315
10-16 20:08:27.783: E/AndroidRuntime(4714): Process: gdx.scala.demo.android, PID: 4714
10-16 20:08:27.783: E/AndroidRuntime(4714): java.lang.NoSuchMethodError: no static method with name='SwigDirector_btIDebugDraw_drawLine__SWIG_0' signature='(Lcom/badlogic/gdx/physics/bullet/linearmath/btIDebugDraw;Lcom/badlogic/gdx/math/Vector3;Lcom/badlogic/gdx/math/Vector3;Lcom/badlogic/gdx/math/Vector3;)V' in class Lcom/badlogic/gdx/physics/bullet/linearmath/LinearMathJNI;
10-16 20:08:27.783: E/AndroidRuntime(4714):     at com.badlogic.gdx.physics.bullet.linearmath.LinearMathJNI.swig_module_init(Native Method)
10-16 20:08:27.783: E/AndroidRuntime(4714):     at com.badlogic.gdx.physics.bullet.linearmath.LinearMathJNI.<clinit>(LinearMathJNI.java:625)
10-16 20:08:27.783: E/AndroidRuntime(4714):     at com.badlogic.gdx.physics.bullet.linearmath.LinearMath.btGetVersion(LinearMath.java:63)
10-16 20:08:27.783: E/AndroidRuntime(4714):     at com.badlogic.gdx.physics.bullet.Bullet.init(Bullet.java:64)
10-16 20:08:27.783: E/AndroidRuntime(4714):     at com.badlogic.gdx.physics.bullet.Bullet.init(Bullet.java:52)
10-16 20:08:27.783: E/AndroidRuntime(4714):     at com.badlogic.gdx.physics.bullet.Bullet.init(Bullet.java:44)
10-16 20:08:27.783: E/AndroidRuntime(4714):     at com.ekit.birdsmail.a.a(Main.scala:42)
10-16 20:08:27.783: E/AndroidRuntime(4714):     at com.badlogic.gdx.backends.android.h.onSurfaceChanged(AndroidGraphics.java:241)
10-16 20:08:27.783: E/AndroidRuntime(4714):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1512)
10-16 20:08:27.783: E/AndroidRuntime(4714):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

( Line 42 at Main.scala is Bullet.init() )

@photex
Copy link
Contributor

photex commented Oct 16, 2015

My apologies but my daughter was just born and I haven't between able to look at this. Gimme a few more days :)

@KonstantTom
Copy link
Author

Ok, sorry. :)

@photex
Copy link
Contributor

photex commented Dec 15, 2015

Hello! I'm here, I'm alive! I'll try and get this resolved asap. Sorry for taking so many ... days/months ... but life is life.

@photex
Copy link
Contributor

photex commented Dec 17, 2015

I've verified the issue. The build works fine, but once it's loaded on the device I see this stacktrace on logcat.

photex pushed a commit that referenced this issue Dec 17, 2015
Basically don't let proguard remove any part of libGDX when you're going to use Bullet.
@photex
Copy link
Contributor

photex commented Dec 17, 2015

Ok @KonstantTom I've just pushed an update to the repo that fixes this. You weren't far off the mark there, but your net wasn't cast wide enough.

I updated the README to reflect the state of things but at least the default won't bail when using Bullet.

@photex photex closed this as completed Dec 17, 2015
@KonstantTom
Copy link
Author

Thank you for work! 👍
At this moment I don't work with libgdx, but I think this fix will be very useful for others. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants