Start a new topic

NullPointerException in ArchitectWebView.removeJSInterfaces()

NullPointerException in ArchitectWebView.removeJSInterfaces()


Hi guys,

Here's another rare crash we're facing using the Android Wikitude SDK:

 

E/AndroidRuntime(18723): FATAL EXCEPTION: main

E/AndroidRuntime(18723): java.lang.RuntimeException: Unable to pause activity {com.skyhookwireless.apps.arinflight/com.s

kyhookwireless.apps.arinflight.PoiViewActivity}: java.lang.NullPointerException

E/AndroidRuntime(18723):        at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2838)

E/AndroidRuntime(18723):        at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2794)

E/AndroidRuntime(18723):        at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2772)

E/AndroidRuntime(18723):        at android.app.ActivityThread.access$800(ActivityThread.java:130)

E/AndroidRuntime(18723):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)

E/AndroidRuntime(18723):        at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime(18723):        at android.os.Looper.loop(Looper.java:137)

E/AndroidRuntime(18723):        at android.app.ActivityThread.main(ActivityThread.java:4745)

E/AndroidRuntime(18723):        at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(18723):        at java.lang.reflect.Method.invoke(Method.java:511)

E/AndroidRuntime(18723):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)

E/AndroidRuntime(18723):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)

E/AndroidRuntime(18723):        at dalvik.system.NativeStart.main(Native Method)

E/AndroidRuntime(18723): Caused by: java.lang.NullPointerException

E/AndroidRuntime(18723):        at com.wikitude.architect.ArchitectWebView.removeJSInterfaces(Unknown Source)

E/AndroidRuntime(18723):        at com.wikitude.architect.ArchitectWebView.onPauseArchitect(Unknown Source)

E/AndroidRuntime(18723):        at com.wikitude.architect.ArchitectView.onPause(Unknown Source)

 

Could you please guide us to the problem cause?

Thanks

Hi there!

This sound kinda special.


Are you sure you handled life-cycle callbacks properly?

Do you have same issue in SimpleARBrowser sample?


Regards,
Andi

Hi Andreas,

I don't think we can reproduce this issue with SimpleARBrowser, it doesn't happen constantly even with our application.

Which lifecycle callbacks are we talking about?

Hi again,

Life-cycle methods are all the on*-Methods, like onResume(), onPause()...
It is very important to forward all your Activity's life-cycle calls to the architectView.
E.g. when you called onDestroy() in your Activity and reenter it but forgot to call onCreate() but call onResume() the architectView is in an inconsistent state, which usually causes unexpected errors, like the one you described.

Please have a close look at the samples in the SDK's "Android"-folder and ensure to not forget any of these calls.

Regards,
Andi

Hi Andreas,

Yes, I know that we should call the on*-methods sequentially, they are tied to the corresponding activity methods in our case. The described problem however may come from the legacy version where onResume has been called in async mode and could probably interfere with onPause (even that they both are executed on the ui thread?). I'll check if we don't have this problem now after removing the async mode from onResume.

Shouldn't it be IllegalStateException in that case anyway like in other cases where the on*-method calls are mixed up?
Login or Signup to post a comment