Skip to content

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

Closed
@Gogul-S

Description

@Gogul-S

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 somewhere.

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 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 created
E/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 created
E/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 more
E/AndroidRuntime( 3745): Caused by: java.lang.reflect.InvocationTargetException
E/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 more
E/AndroidRuntime( 3745): Caused by: java.lang.ExceptionInInitializerError
E/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 more
E/AndroidRuntime( 3745): Caused by: java.lang.IllegalStateException: Expected Android API level 21+ but was 19
E/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)

Screenshot

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: AndroidAndroid applications.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions