'void com.getcapacitor.Bridge.onStart()' on a null object reference
Asked Answered
D

1

6

I am wrapping a React application into Capacitor. When I run it from AndroidStudio the application starts and stops immediately. I receive the following.

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.app, PID: 20226
    java.lang.NullPointerException: Attempt to invoke virtual method 'void com.getcapacitor.Bridge.onStart()' on a null object reference
        at com.getcapacitor.BridgeActivity.onStart(BridgeActivity.java:124)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1435)
        at android.app.Activity.performStart(Activity.java:8019)
        at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3475)
        at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
        at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

It seems that something absent. I checked tutorials. @capacitor/core is present.

Dispossess answered 21/3, 2021 at 16:48 Comment(5)
In my case @capacitor/core was absent. I tried the second time. It started working.Dispossess
I am having the same issue. Can you explain how is fix in detail, please? This is my capacitor version "@angular/router": "^9.1.12", "@capacitor/android": "^2.4.2", "@capacitor/core": "^2.4.2", "@capacitor/ios": "^2.4.2",Cutlass
Can you elaborate @victor-shelepen please?Cutlass
How can I help you? The solution is too easy. You need to recheck.Dispossess
In my case @capacitor/core was absent, I checked twice.Dispossess
W
0

I was able to fix this issue by downgrading @capacitor/cli to v2.4.5.

npm i @capacitor/[email protected]

I was facing issue with v3.0.1.

Waylay answered 29/9, 2022 at 8:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.