Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap method returned null - Android crash immediately on launch

Newbie to React Native and react-native-navigation. App works correctly on iOS but throws the exception below very quickly on launch:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.engagereact, PID: 8105
    java.lang.BootstrapMethodError: Exception from call site #3 bootstrap method
        at com.reactnativenavigation.react.JsDevReloadHandler.<init>(JsDevReloadHandler.java:29)
        at com.reactnativenavigation.react.ReactGateway.<init>(ReactGateway.java:29)
        at com.engagereact.MainApplication.createReactGateway(MainApplication.java:29)
        at com.reactnativenavigation.NavigationApplication.onCreate(NavigationApplication.java:28)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
        at android.app.ActivityThread.access$1100(ActivityThread.java:199)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        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:858)
     Caused by: java.lang.ClassCastException: Bootstrap method returned null
        at com.reactnativenavigation.react.JsDevReloadHandler.<init>(JsDevReloadHandler.java:29) 
        at com.reactnativenavigation.react.ReactGateway.<init>(ReactGateway.java:29) 
        at com.engagereact.MainApplication.createReactGateway(MainApplication.java:29) 
        at com.reactnativenavigation.NavigationApplication.onCreate(NavigationApplication.java:28) 
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871) 
        at android.app.ActivityThread.access$1100(ActivityThread.java:199) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6669) 
        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:858) 

react-native-navigation/lib/android/app/source/etc does indeed return null in line 29 - private ReloadListener reloadListener = () -> {};

Dependencies:

[email protected] /Users/komara/Documents/infor-repos/EngageReact
├── @babel/[email protected]
├── @babel/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

I'm guessing my dependencies are wrong, but have no idea how to fix.

like image 935
Kevin OMara Avatar asked Jan 16 '19 19:01

Kevin OMara


1 Answers

Set Java 8 in ./android/build.gradle adding these lines

compileOptions {
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
}
like image 166
dreinoso Avatar answered Nov 16 '22 17:11

dreinoso