I am noticing a bug in the Android version of the WIkitude PhoneGap plugin.
The app crashes consistently after the following steps:
load the app
click JS button in PhoneGap view to load the AR view
click JS button to close the AR view and return to PhoneGap view
pause and resume the app
click JS button to load the AR view again - the app loading animation shows, but then the camera freezes and the app crashes
If you pause and resume the app while the AR view is open, the AR view continues to work but if you close it and try to re-load it then the same thing occurs.
The crash log that it gives is:
11-14 14:51:45.992: D/AndroidRuntime(10959): Shutting down VM
11-14 14:51:45.992: W/dalvikvm(10959): threadid=1: thread exiting with uncaught exception (group=0x40a9fa08)
11-14 14:51:45.992: E/AndroidRuntime(10959): FATAL EXCEPTION: main
11-14 14:51:45.992: E/AndroidRuntime(10959): java.lang.IllegalStateException: onResume() needs to be called before this method is called in the appropriate lifecycle method
11-14 14:51:45.992: E/AndroidRuntime(10959): at com.wikitude.architect.ArchitectView.onPause(Unknown Source)
11-14 14:51:45.992: E/AndroidRuntime(10959): at com.wikitude.phonegap.WikitudePlugin.removeArchitectView(WikitudePlugin.java:376)
11-14 14:51:45.992: E/AndroidRuntime(10959): at com.wikitude.phonegap.WikitudePlugin.access$1(WikitudePlugin.java:373)
11-14 14:51:45.992: E/AndroidRuntime(10959): at com.wikitude.phonegap.WikitudePlugin$1.run(WikitudePlugin.java:134)
11-14 14:51:45.992: E/AndroidRuntime(10959): at android.os.Handler.handleCallback(Handler.java:608)
11-14 14:51:45.992: E/AndroidRuntime(10959): at android.os.Handler.dispatchMessage(Handler.java:92)
11-14 14:51:45.992: E/AndroidRuntime(10959): at android.os.Looper.loop(Looper.java:156)
11-14 14:51:45.992: E/AndroidRuntime(10959): at android.app.ActivityThread.main(ActivityThread.java:5045)
11-14 14:51:45.992: E/AndroidRuntime(10959): at java.lang.reflect.Method.invokeNative(Native Method)
11-14 14:51:45.992: E/AndroidRuntime(10959): at java.lang.reflect.Method.invoke(Method.java:511)
11-14 14:51:45.992: E/AndroidRuntime(10959): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-14 14:51:45.992: E/AndroidRuntime(10959): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-14 14:51:45.992: E/AndroidRuntime(10959): at dalvik.system.NativeStart.main(Native Method)
Am I missing something out in my code, or is this a bug in the plugin? Any tips greatly appreciated.
Thanks,
Dan
A
Andreas Fötschl
said
over 10 years ago
Hi Dan!
This is in fact not expected behavior. Which phonegap version are you using? Current one is optimized for 2.0 but we'll publish an update for 2.2+ very soon. Could you please try the Basic-Sample project and check if same error occurs there as well since we cannot reproduce the issue.
Cheers, Andi
D
Dan Karran
said
over 10 years ago
Hi Andi,
I'm using Phonegap 2.0.0 and Wikitude SDK 1.1 in my app.
I've tried with the Basic sample project from the Phonegap Github repo, and I can replicate the same thing by making the following changes to mirror roughly what I'm trying to do...
and update onClickInARchitectWorld to inlcude the following command so the plugin closes when the label is clicked:
WikitudePlugin.close();
You should then be able to click the link in the Phonegap page to load up Wikitude and click the label to close it. This works fine, even multiple times, but stops working after you've clicked the home button while looking at the Phonegap page and then come back into the app. If you click the home button while you're in the Wikitude view and then come back in, the Wikitude view resumes fine, but won't load again if you click the label to close the view and then try clicking the link.
Hopefully that makes sense, and helps you replicate the issue?
Thanks,
Dan
A
Andreas Fötschl
said
over 10 years ago
Hi Dan!
Your line WikitudePlugin.setOnUrlInvokeCallback(..)
will register a function that is called each time you use something like
Please aso have a look at the error-console, implement the error callbacks and ensure the close() function is really called, since we do not support more than one active architectView being open at any time.
Dan Karran