Cardboard support issues with jME 3.1 beta1?

Hello everyone,
I’m currently working on a cardboard VR project for Android. I’ve followed the instructions on the cardboard project page [GitHub - neph1/jme-cardboard: Google Cardboard integration for jMonkeyEngine 3] and set the BasicGame (the blue cube app) project up based on the instructions (added Android deployment, disabled compile on save and added the jme-cardboard.jar and cardboard.jar + created fragment and made MainActivity extend CardboardActivity + edited the main.xml file to point to the fragment).
The SDK shows no errors, all necessary files seem to be available. However when I run it on a phone (Samsung Galaxy S6 Edge) it crashes and gives me this error:

10-05 21:55:36.711 8637 8637 E AndroidRuntime: FATAL EXCEPTION: main
10-05 21:55:36.711 8637 8637 E AndroidRuntime: Process: com.mycompany.mygame, PID: 8637
10-05 21:55:36.711 8637 8637 E AndroidRuntime: java.lang.IncompatibleClassChangeError: The method ‘com.jme3.system.JmeContext com.jme3.app.Application.getContext()’ was expected to be of type virtual but instead was found to be of type interface (declaration of ‘com.jme3.app.CardboardHarnessFragment’ appears in /data/app/com.mycompany.mygame-1/base.apk)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at com.jme3.app.CardboardHarnessFragment.onCreate(CardboardHarnessFragment.java:46)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.Fragment.performCreate(Fragment.java:2242)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1141)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.FragmentManagerImpl.addFragment(FragmentManager.java:1245)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2218)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.FragmentController.onCreateView(FragmentController.java:98)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.Activity.onCreateView(Activity.java:6070)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:766)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:527)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:474)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.Activity.setContentView(Activity.java:2387)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at com.mycompany.mygame.MainActivity.onCreate(MainActivity.java:33)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6876)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.ActivityThread.access$1100(ActivityThread.java:222)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.os.Looper.loop(Looper.java:158)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7229)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
10-05 21:55:36.711 8637 8637 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Does this mean that com.jme3.app.Application is not supposed to be an interface? Is this somehow linked to the fact that I use jME 3.1 beta1?
@rickard Do you think it is possible that cardboard support doesn’t work with the newer versions?
Does anyone have an idea about what the issue might be?
Thank you very much in advance,
Jalovius

Hi, I’ve been away.
Yes, it’s definitely a difference between 3.0 and 3.1.
The code doesn’t seem to explicitly use the non-interface Application so the code should be compatible. Have you tried cleaning the project and making sure the libs are correct as well?

Hello,
Thank you very much for your reply. I have indeed cleaned it (Right-click on Project and then “Clean”) and the libs I use are the default jme 3.1 beta libraries + the newest version of jme-cardboard.jar and cardboard.jar, so I believe they should be correct.

DId you manage to get anywhere with this? I’m also trying out the cardboard project for the first time and getting what looks like a similar error:

E/AndroidRuntime(19042): java.lang.IncompatibleClassChangeError: The method ‘com.jme3.system.JmeContext com.jme3.app.Application.getContext()’ was expected to be of type virtual but instead was found to be of type interface (declaration of ‘java.lang.reflect.ArtMethod’ appears in /system/framework/core-libart.jar)
E/AndroidRuntime(19042): at com.jme3.app.CardboardHarnessFragment.onCreate(CardboardHarnessFragment.java:46)

Hello Robin,
No, I’m sorry to say I haven’t. As I have a certain time pressure to finish a first version of the app, I decided to do something simpler using the Google VR SDK for Android instead.
However, I would still be very interested in a solution for the problem, so please tell me if you can solve it.
Good luck!

Considering that my cardboard lib only supports 0.7, I would recommend switching to GitHub - nordfalk/gvr-android-jme: JMonkeyEngine integration with Google VR SDK instead, which is more up-to-date