NoSuchMethodError in Box2D after using <treeShaker>agressive in RoboVM

122 views Asked by At

The app crashes on startup. Here is the stack trace. The app works fine with the setting set to "conservative", but I'd definitely like to have it take up less space.

Versions: gdxVersion = '1.6.1' roboVMVersion = '1.4.0'

This is in dependencies under project(":ios")

compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-ios"

This is in dependencies under project(":core")

compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"

Exception:

java.lang.NoSuchMethodError: beginContact
    at com.badlogic.gdx.physics.box2d.World.newWorld(Native Method)
    at com.badlogic.gdx.physics.box2d.World.<init>(World.java)
    at com.cereal.stackking.worlds.GameWorld.<init>(GameWorld.java)
    at com.cereal.stackking.worlds.ArcadeWorld.<init>(ArcadeWorld.java)
    at com.cereal.stackking.screens.ArcadeScreen.startNewWorld(ArcadeScreen.java)
    at com.cereal.stackking.screens.ArcadeScreen.<init>(ArcadeScreen.java)
    at com.cereal.stackking.screens.MainMenuScreen.populateTable(MainMenuScreen.java)
    at com.cereal.stackking.screens.MainMenuScreen.<init>(MainMenuScreen.java)
    at com.cereal.stackking.Staq.load(Staq.java)
    at com.cereal.stackking.screens.SplashScreen.render(SplashScreen.java)
    at com.badlogic.gdx.Game.render(Game.java)
    at com.cereal.stackking.Staq.render(Staq.java)
    at com.badlogic.gdx.backends.iosrobovm.IOSGraphics.draw(IOSGraphics.java)
    at com.badlogic.gdx.backends.iosrobovm.IOSGraphics$1.draw(IOSGraphics.java)
    at com.badlogic.gdx.backends.iosrobovm.IOSGraphics$1.$cb$drawRect$(IOSGraphics.java)
    at org.robovm.apple.uikit.UIApplication.main(Native Method)
    at org.robovm.apple.uikit.UIApplication.main(UIApplication.java)
    at com.cereal.stackking.IOSLauncher.main(IOSLauncher.java)
1

There are 1 answers

2
nEx.Software On BEST ANSWER

The Box2D uses reflection in native code to get access to the java methods to call for contact listeners. Does RoboVM have any method by which you can tell the tree shaker to keep certain classes/methods (a la proguard)? If not, you'll probably have to stick with conservative mode (and perhaps file a feature request with RoboVM).