React-native-splash-screen: Android App crashes on Open: SplashScreen.hide()

Created on 16 Feb 2018  Â·  14Comments  Â·  Source: crazycodeboy/react-native-splash-screen

Possibly similar to #167, but instead of crashing on open, this crashes on hide, and only in Android 4.4.x:

E/AndroidRuntime( 1605): FATAL EXCEPTION: main
E/AndroidRuntime( 1605): Process: com.kickserv.kickserv, PID: 1605
E/AndroidRuntime( 1605): java.lang.NoClassDefFoundError: org.devio.rn.splashscreen.SplashScreen
E/AndroidRuntime( 1605):    at com.kickserv.kickserv.MainActivity.onCreate(MainActivity.java:32)
E/AndroidRuntime( 1605):    at android.app.Activity.performCreate(Activity.java:5231)
E/AndroidRuntime( 1605):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime( 1605):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
E/AndroidRuntime( 1605):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
E/AndroidRuntime( 1605):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime( 1605):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime( 1605):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 1605):    at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 1605):    at android.app.ActivityThread.main(ActivityThread.java:5001)
E/AndroidRuntime( 1605):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1605):    at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 1605):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
E/AndroidRuntime( 1605):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
E/AndroidRuntime( 1605):    at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(  564):   Force finishing activity com.kickserv.kickserv/.MainActivity

This is with SDK version 25

Most helpful comment

Fixed it:

added multiDexEnabled true in the defaultConfig of the build.gradle and compile 'com.android.support:multidex:1.0.3'
added import android.support.multidex.MultiDex; and MultiDex.install(this); on the onCreate of the MainApplication.java

All 14 comments

+1

+1

+1

+1

You try remove: <item name="android:windowIsTranslucent">true</item> in android/app/src/main/res/values/styles.xml

+1

@ntnamag thanks you solve my problems

only in Android 4.4.x:
+1

Fixed it:

added multiDexEnabled true in the defaultConfig of the build.gradle and compile 'com.android.support:multidex:1.0.3'
added import android.support.multidex.MultiDex; and MultiDex.install(this); on the onCreate of the MainApplication.java

@hnliyuan many thanks. you saved me <3

@hnliyuan thank you! This fixed < 4.4.2 support. If you have both Zendesk SDK and SplashScreen in a React Native project you will need this

I got the same issue on following environment.

environment:
"react": "16.8.6",
"react-native": "0.60.3",
"react-native-navigation": "^3.0.0-alpha.6",
"react-native-splash-screen": "^3.2.0",

adb logcat *:E

E/AndroidRuntime( 8411): FATAL EXCEPTION: main
E/AndroidRuntime( 8411): Process: mypackage.package, PID: 8411
E/AndroidRuntime( 8411): java.lang.NoClassDefFoundError: com.reactnativenavigation.react.NavigationReactNativeHost$1
E/AndroidRuntime( 8411): at com.reactnativenavigation.react.NavigationReactNativeHost.(NavigationReactNativeHost.java:29)
E/AndroidRuntime( 8411): at br.com.arpasistemas.coletor.MainApplication$1.(MainApplication.java:25)
E/AndroidRuntime( 8411): at br.com.arpasistemas.coletor.MainApplication.createReactGateway(MainApplication.java:25)
E/AndroidRuntime( 8411): at com.reactnativenavigation.NavigationApplication.onCreate(NavigationApplication.java:28)
E/AndroidRuntime( 8411): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
E/AndroidRuntime( 8411): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4753)
E/AndroidRuntime( 8411): at android.app.ActivityThread.access$1500(ActivityThread.java:166)
E/AndroidRuntime( 8411): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1343)
E/AndroidRuntime( 8411): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 8411): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 8411): at android.app.ActivityThread.main(ActivityThread.java:5590)
E/AndroidRuntime( 8411): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 8411): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 8411): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
E/AndroidRuntime( 8411): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
E/AndroidRuntime( 8411): at dalvik.system.NativeStart.main(Native Method)
E/android.os.Debug( 585): !@Dumpstate > sdumpstate -k -t -z -d -m 8411 -o /data/log/dumpstate_app_error

Using RN < 0.60 that bug doesnt occours. I have tryied the @hnliyuan solution but it doesnt worked for me.

This bug happen just in android 4.4.

Any update will be appreciated?

@hnliyuan worked for me with a little changes:
on app/build.gradle add implementation 'com.android.support:multidex:1.0.3'
on MainApplication.java add like he said MultiDex.install(this) but not the import. As implementation 'com.android.support:multidex:1.0.3' is for androidx, so import isimport androidx.multidex.MultiDex;

Was this page helpful?
0 / 5 - 0 ratings