Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReactNative app craches on Android 11 device with targetSdkVersion 30 #30366

Closed
volodymyrtaliar opened this issue Nov 11, 2020 · 23 comments
Closed
Labels
Needs: Triage 🔍 Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@volodymyrtaliar
Copy link

volodymyrtaliar commented Nov 11, 2020

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(R) Core(TM) 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

@vomchik
Copy link

vomchik commented Nov 12, 2020

Make sure that you run ‘react-native start’

@volodymyrtaliar
Copy link
Author

Make sure that you run ‘react-native start’

I did run ‘react-native start’, the issue is still there.

@dulmandakh
Copy link
Contributor

Some dependencies, like OkHTTP3, crashing when targetSdkVersion is 29 or above, please don't change this. 0.63.4 and 0.64 bumped all dependencies to latest ones.

@gourav-singhal
Copy link

gourav-singhal commented Dec 18, 2020

Getting this issue on RN version 0.62.2 as well target version is 29

@nlaitanatix
Copy link

I have similar error for react-native@0.61.5. I set only targetSdkVersion on 29 and solved my problem.
Notice that I don't change compileSdkVersion, that's stills in 30

@manohar-octifi
Copy link

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

@pokatomnik
Copy link

Any updates on that? As far as I know Google will require targetSDKVersion = 30 starting from November 2021.

@manohar-octifi
Copy link

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

@Aarchi-Ayoub
Copy link

@manohar-octifi What version of sentry/react-native library you use now ?

@manohar-octifi
Copy link

@manohar-octifi What version of sentry/react-native library you use now ?

2.0 is the version worked for me

@Aarchi-Ayoub
Copy link

@manohar-octifi buildToolsVersion compileSdkVersion targetSdkVersion all have 30 as value ?

@manohar-octifi
Copy link

@manohar-octifi buildToolsVersion compileSdkVersion targetSdkVersion all have 30 as value ?

Yeah that's right

@girish54321
Copy link

🔥🔥🔥
Finally 🦾 fixed by help form 💻 stack-overflow

@ttkien
Copy link

ttkien commented Nov 8, 2021

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

It works for me 💯 💯 💯 💯 💯

@carefreeav09
Copy link

@girish54321 where did you add the lines?

implementation("com.squareup.okhttp3:okhttp:4.9.1")
implementation("com.squareup.okhttp3:okhttp-urlconnection:4.9.1") ?

@girish54321
Copy link

@carefreeav09
At /projectName/android/app/build.gradle
Under dependencies

dependencies {
      //------------

    implementation("com.squareup.okhttp3:okhttp:4.9.1")
    implementation("com.squareup.okhttp3:okhttp-urlconnection:4.9.1")

  //--------
}

@ashishprasad2163
Copy link

@carefreeav09

implementation("com.squareup.okhttp3:okhttp:4.9.1")
implementation("com.squareup.okhttp3:okhttp-urlconnection:4.9.1") 

Did it work for you?
I added this but still crashing.

@ErickMaeda
Copy link

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

It work's for me!

My sentry package is now: "@sentry/react-native": "^2.0.0"

And followed to migration guide from their docs. https://docs.sentry.io/platforms/react-native/migration/#from-1x-to-2x

@ashishprasad2163
Copy link

@ErickMaeda What version of react-native?

@ErickMaeda
Copy link

@ErickMaeda What version of react-native?

@ashishprasad2163
"react-native": "0.59.10"

@ashishprasad2163
Copy link

@ErickMaeda Ok Thanks😊. I upgraded sentry to 2.0.0. Tried @carefreeav09's solution. Upgraded clever tap also. Still, the app is crashing on android 11 devices without any error and working fine on android 9 and below devices.

I'm new to mobile development. Please suggest some way to debug it. I'm on "react-native": "^0.60.5"

@manohar-octifi
Copy link

@ashishprasad2163 Try running the release build with logcat you can find the package that's causing the issue

  1. Create an APK and install it on a device
  2. connect the device with USB
  3. Run adb logcat to see logs (better if you do it from Android Studio)
  4. Now open app on your device and notice crash logs

@ashishprasad2163
Copy link

ashishprasad2163 commented Nov 19, 2021

@manohar-octifi Thanks for sharing the steps.

I did as you said and got this. Is this useful?
I was searching this on StackOverflow and GitHub, maybe something is wrong with the webview package. Not sure.

--------- beginning of crash
2021-11-19 02:29:35.780 20128-20221/? A/libc: Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x728afff000 in tid 20221 (mqt_js), pid 20128 (angle.traveller)
2021-11-19 02:29:35.802 726-726/? E/qdmetadata: paramType 2048 not supported
2021-11-19 02:29:35.817 726-726/? E/qdmetadata: paramType 2048 not supported
2021-11-19 02:29:35.821 726-726/? E/qdmetadata: paramType 2048 not supported
2021-11-19 02:29:35.826 726-726/? E/qdmetadata: paramType 2048 not supported
2021-11-19 02:29:35.843 726-726/? E/qdmetadata: paramType 2048 not supported
2021-11-19 02:29:35.853 726-726/? E/qdmetadata: paramType 2048 not supported
2021-11-19 02:29:35.874 726-726/? E/qdmetadata: paramType 2048 not supported
2021-11-19 02:29:35.891 726-726/? E/qdmetadata: paramType 2048 not supported
2021-11-19 02:29:35.901 726-726/? E/qdmetadata: paramType 2048 not supported
2021-11-19 02:29:35.921 20235-20235/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** <<<
2021-11-19 02:29:35.922 20235-20235/? A/DEBUG: uid: 10205
2021-11-19 02:29:35.922 20235-20235/? A/DEBUG: signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x728afff000
2021-11-19 02:29:35.922 20235-20235/? A/DEBUG:     x0  000000728ba1c6d0  x1  000000728afff000  x2  0000000000000000  x3  000000728b124c90
2021-11-19 02:29:35.922 20235-20235/? A/DEBUG:     x4  000000728b42c960  x5  000000728b124d00  x6  fff9000000000000  x7  fff9000000000000
2021-11-19 02:29:35.922 20235-20235/? A/DEBUG:     x8  0000007297382ca4  x9  ffff000000000000  x10 000000728b400000  x11 000000728b42c8a8
2021-11-19 02:29:35.922 20235-20235/? A/DEBUG:     x12 fff9000000000000  x13 fff9000000000000  x14 0000000000000000  x15 000000000001ffff
2021-11-19 02:29:35.922 20235-20235/? A/DEBUG:     x16 00000072974b9718  x17 000000760facf400  x18 0000000000000038  x19 000000728ba1c6d0
2021-11-19 02:29:35.922 20235-20235/? A/DEBUG:     x20 b40000745ea84af0  x21 b40000745ea84850  x22 0000000000000000  x23 000000728afff000
2021-11-19 02:29:35.922 20235-20235/? A/DEBUG:     x24 000000728ba1f000  x25 b40000728affe550  x26 0000000000000000  x27 b40000745ea84d50
2021-11-19 02:29:35.922 20235-20235/? A/DEBUG:     x28 0000000000000000  x29 000000728ba1c630
2021-11-19 02:29:35.922 20235-20235/? A/DEBUG:     lr  0000007297343f78  sp  000000728ba1c5b0  pc  0000007297382ca4  pst 00000000a0000000


@facebook facebook locked as resolved and limited conversation to collaborators Nov 21, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Nov 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests