question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ReactNative app craches on Android 11 device with targetSdkVersion 30

See original GitHub issue

Description

ReactNative app crashes on Android 11 device with targetSdkVersion 30.

React Native version:

react-native info output: System: OS: macOS 10.15.7 CPU: (12) x64 Intel® Core™ i7-9750H CPU @ 2.60GHz Memory: 209.25 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.16.3 - /usr/local/bin/node Yarn: 1.17.3 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.0 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 Android SDK: API Levels: 23, 25, 26, 27, 28, 29, 30 Build Tools: 26.0.2, 27.0.3, 28.0.0, 28.0.3, 29.0.0, 29.0.2, 30.0.0, 30.0.1 System Images: android-26 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom_64, android-30 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom_64 Android NDK: 21.3.6528147 IDEs: Android Studio: 4.1 AI-201.8743.12.41.6858069 Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild Languages: Java: 1.8.0_211 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.2 => 0.63.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

[Updated] Steps To Reproduce

  1. Connect Android 11 device or create Android 11 emulator
  2. $ react-native init MyApp --version 0.63.2
  3. Update targetSdkVersion and compileSdkVersion to be 30 in build.gradle
  4. Open new terminal window and do: $ cd MyApp && react-native start --port 8082
  5. In previous terminal window do: $ cd MyApp && react-native run-android --port 8082

Actual Results

Exception in native call java.lang.RuntimeException: Unable to load script. Make sure you’re either running a Metro server (run ‘react-native start’) or that your bundle ‘index.android.bundle’ is packaged correctly for release. at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method) at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:234) at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:29) at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:258) at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1293) at com.facebook.react.ReactInstanceManager.access$1100(ReactInstanceManager.java:131) at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1016) at java.lang.Thread.run(Thread.java:923)

Expected Results

App should build and run successfully on Android 11 device/emulator with targetSdkVersion 30

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23 (1 by maintainers)

github_iconTop GitHub Comments

22reactions
manohar-octificommented, Sep 26, 2021

The crash fixed for me on updating sentry/react-native library, please check your dependencies support targetsdkversion 30

19reactions
manohar-octificommented, Sep 7, 2021

Why is it closed changing targetSdkVersion back to 29 is not a permanent fix, It is mandatory to update targetSdkVersion to 30 before November for existing apps and before August for new apps

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashes on Android 11 after targetSdkVersion upgrade to ...
It is a React Native project, and the app works well till android 10. issue persist only in android 11. i tried updating...
Read more >
App crashes on Android 11 after targetSdkVersion upgrade to ...
Coding example for the question App crashes on Android 11 after targetSdkVersion upgrade to 30 without any error logs-React Native.
Read more >
Migrate apps to Android 12
Quick overview of the steps involved in bringing your app to Android 12. ... and publish an update without needing to change the...
Read more >
BlackBerry Dynamics SDK for React Native version 10.1
For more information, see ReactNative app crashes on Android 11 device with targetSdkVersion 30. When an app is in dark mode, text in...
Read more >
Let's use Android 12, Migration of our Android Apps ... - Medium
“In this, I update one of my projects which was supporting Android11 (API 30) and was using a few third-party libraries I spent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found