Android plugin help

It’s been a while since I’ve had to dig into the Android modules for our app, so I decided to start from scratch. I set the module platform to 2.8.6, deleted the existing “an-inspector” directory, and then updated the inspector project through the toolkit. Moved all of my code back into the project. It builds fine. Trying to run the inspector on my moto g(7) play (running Android 9) I get the error below. Have I done something dumb? Thanks for any help.

E/AndroidRuntime: FATAL EXCEPTION: main
Process: io.trigger.forge.android.inspector, PID: 25669
java.lang.RuntimeException: Unable to start activity ComponentInfo{io.trigger.forge.android.inspector/io.trigger.forge.android.core.ForgeActivity}: java.lang.NullPointerException: Attempt to invoke virtual method ‘void android.widget.RelativeLayout.setVisibility(int)’ on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3122)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3261)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1977)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6923)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘void android.widget.RelativeLayout.setVisibility(int)’ on a null object reference
at io.trigger.forge.android.core.ForgeViewController$4.run(ForgeViewController.java:200)
at android.app.Activity.runOnUiThread(Activity.java:6294)
at io.trigger.forge.android.core.ForgeViewController.setNavigationBarHidden(ForgeViewController.java:195)
at io.trigger.forge.android.core.ForgeViewController.onCreate(ForgeViewController.java:54)
at io.trigger.forge.android.core.ForgeActivity.onCreate(ForgeActivity.java:315)
at android.app.Activity.performCreate(Activity.java:7148)
at android.app.Activity.performCreate(Activity.java:7139)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1293)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3102)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3261)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1977)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6923)

E/AndroidRuntime: FATAL EXCEPTION: main
Process: io.trigger.forge.android.inspector, PID: 25669
java.lang.RuntimeException: Unable to start activity 
ComponentInfo{io.trigger.forge.android.inspector/io.trigger.forge.android.core.ForgeActivity}: java.lang.NullPointerException: 
Attempt to invoke virtual method ‘void android.widget.RelativeLayout.setVisibility(int)’ on a null object reference

So this is happening inside Trigger.IO code during initial application creation.

Specifically it’s happening when we hide the navigation bar (aka topbar) after initial app creation.

For some reason the navigationBar object itself is null, as if it has never been created.

Which shouldn’t, in theory, ever happen.

Hrmmmm…

Can you please try again against the latest stable release of the platform: v2.9.1 ?

There’s also a migration guide.

If it’s still causing the same issue I’ll be happy to dig a bit deeper from my side if you can send me a source repository or zip file with the module code.

Oh excellent, updating to 2.9.1 worked! As always, thanks for the help!

1 Like