Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29791

React Native App Crashes on Launch in Android (API 19)

$
0
0

Description

I have created a project with react-native-cli

When I launch the app using the command "react-native run-android" on Devices and Emulators with Android API level 21+ App is launching.

But for devices less than API 21, the app crashing on launch.

I have specified in android Gradle minSdk version to 16.

I viewed the stack trace using "adb logcat" the crash was due to OkHttp3 that is used internally in Facebook Flipper, which is expecting API 21+.

I haven't used any OkHttp3 Dependency explicitly in my app

React Native version:

6.14.4

Steps To Reproduce

  1. Create a project using react-native CLI not Expo CLI
  2. Navigate to the project folder
  3. Connect a device or an emulator with API less than 21
  4. run command "react-native run-android" to run the app on the connected device

Expected Results

The app should launch without any crash.

Android Logs

E/AndroidRuntime( 3745): java.lang.RuntimeException: Unable to create application com.infifive.MainApplication: java.lang.RuntimeException: Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be createdE/AndroidRuntime( 3745):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4347)E/AndroidRuntime( 3745):    at android.app.ActivityThread.access$1500(ActivityThread.java:135)E/AndroidRuntime( 3745):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)E/AndroidRuntime( 3745):    at android.os.Handler.dispatchMessage(Handler.java:102)E/AndroidRuntime( 3745):    at android.os.Looper.loop(Looper.java:136)E/AndroidRuntime( 3745):    at android.app.ActivityThread.main(ActivityThread.java:5017)E/AndroidRuntime( 3745):    at java.lang.reflect.Method.invokeNative(Native Method)E/AndroidRuntime( 3745):    at java.lang.reflect.Method.invoke(Method.java:515)E/AndroidRuntime( 3745):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)E/AndroidRuntime( 3745):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)E/AndroidRuntime( 3745):    at dalvik.system.NativeStart.main(Native Method)E/AndroidRuntime( 3745): Caused by: java.lang.RuntimeException: Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be createdE/AndroidRuntime( 3745):    at com.facebook.react.devsupport.DevSupportManagerFactory.create(DevSupportManagerFactory.java:90)E/AndroidRuntime( 3745):    at com.facebook.react.ReactInstanceManager.<init>(ReactInstanceManager.java:238)E/AndroidRuntime( 3745):    at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:281)E/AndroidRuntime( 3745):    at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:87)E/AndroidRuntime( 3745):    at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:39)E/AndroidRuntime( 3745):    at com.infifive.MainApplication.onCreate(MainApplication.java:47)E/AndroidRuntime( 3745):    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)E/AndroidRuntime( 3745):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)E/AndroidRuntime( 3745):    ... 10 moreE/AndroidRuntime( 3745): Caused by: java.lang.reflect.InvocationTargetExceptionE/AndroidRuntime( 3745):    at java.lang.reflect.Constructor.constructNative(Native Method)E/AndroidRuntime( 3745):    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)E/AndroidRuntime( 3745):    at com.facebook.react.devsupport.DevSupportManagerFactory.create(DevSupportManagerFactory.java:80)E/AndroidRuntime( 3745):    ... 17 moreE/AndroidRuntime( 3745): Caused by: java.lang.ExceptionInInitializerErrorE/AndroidRuntime( 3745):    at okhttp3.OkHttpClient.newSslSocketFactory(OkHttpClient.java:263)E/AndroidRuntime( 3745):    at okhttp3.OkHttpClient.<init>(OkHttpClient.java:229)E/AndroidRuntime( 3745):    at okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:1015)E/AndroidRuntime( 3745):    at com.facebook.react.devsupport.DevServerHelper.<init>(DevServerHelper.java:132)E/AndroidRuntime( 3745):    at com.facebook.react.devsupport.DevSupportManagerImpl.<init>(DevSupportManagerImpl.java:183)E/AndroidRuntime( 3745):    ... 20 moreE/AndroidRuntime( 3745): Caused by: java.lang.IllegalStateException: Expected Android API level 21+ but was 19E/AndroidRuntime( 3745):    at okhttp3.internal.platform.AndroidPlatform.buildIfSupported(AndroidPlatform.java:238)E/AndroidRuntime( 3745):    at okhttp3.internal.platform.Platform.findPlatform(Platform.java:202)E/AndroidRuntime( 3745):    at okhttp3.internal.platform.Platform.<clinit>(Platform.java:79)`

Viewing all articles
Browse latest Browse all 29791

Latest Images

Trending Articles



Latest Images