react-native: App Crashes - On upgrading to Android 14(SDK 34)
Description
Currently, my codebase supports Android 13 (SDK version: 33). I wanted to upgrade to SDK 33(Android 14)
On Android 14 updates, the following changes have been made:
kotlinVersion = “1.6.0” buildToolsVersion = “34.0.0” minSdkVersion = 23 compileSdkVersion = 34 targetSdkVersion = 34
My current React Native version is 0.70.8.
However, upon launching the application, I encountered an issue where the App Crashes immediately on the launch. To investigate this, I pulled a Bug Report, which provided the following insights:
- Caused by: java.lang.RuntimeException: Requested enabled DevSupportManager, but BridgeDevSupportManager class was not found or could not be created.
- Caused by: java.lang.SecurityException: : One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn’t being registered exclusively for system broadcasts.
- Caused by: java.lang.reflect.InvocationTargetException.
- Caused by: android.os.RemoteException: Remote stack trace.
React Native Version
0.70.8
Output of npx react-native info
System: OS: macOS 14.0 CPU: (8) arm64 Apple M1 Memory: 65.91 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.4.0 - /opt/homebrew/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.8.1 - /opt/homebrew/bin/npm Watchman: 2023.07.10.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.13.0 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0 Android SDK: Not Found IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.10406996 Xcode: 15.0.1/15A507 - /usr/bin/xcodebuild Languages: Java: 11.0.19 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.8 => 0.70.8 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
Update Build.gradle’s version to support SDK version 34.
Snack, screenshot, or link to a repository
Build.gradle file: https://snack.expo.dev/@shaminisaravanan/android14
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Comments: 25 (4 by maintainers)
I upgraded to 0.73 from RN0.72.7 and android sdk 34,encountered an issue where the App Crashes immediately on the launch
when 0.73 just released,I also met same problem,if just change RN version,it is wrong,bcz android folder part files changed,so I suggest that you create new project with RN 0.73,copy your code to new project ,or replace android folder with new android
I had the same issue with my app running on React Native v0.67.4 I’ve published a blog how I patch this version of React Native to support Android 14 (SDK 34) https://medium.com/@zahitesh/android-14-sdk-34-support-for-react-native-ver-0-69-x-2554f4dc937d
I’m also facing this now, any update on this?
Hi cipolleschi, here i am using recent version of react-native(72.6) and android target version 34. But i am still facing the same issue. I have found one solution related to RECEIVER_NOT_EXPORTED and I have applied check for android 14(34). Link: https://stackoverflow.com/questions/77235063/one-of-receiver-exported-or-receiver-not-exported-should-be-specified-when-a-rec But still have same issue. I don’t how to get out of this problem.
Have a look at this conversation: https://github.com/reactwg/react-native-releases/discussions/84#discussioncomment-7273663
We tried to add support for new version of Android in 0.70, but that’s not possible unfortunately. If you need to support new Android SDK and Android 14, you have to update to a newer version of React Native.
Removing
minifyEnabled true
for debug config fromandroid/app/build.gradle
fixed the issue. (For me, the debug build was crashing only, not the release one).I’m closing this issue as related to React Native 0.70 (which is no longer supported). The author hasn’t provided a reproducer also.
@zkteco-home please open a new issue
Thanks for the issue. Consider that, as soon as we will release 0.73 as stable (ETA: end Nov/start Dec) we are not going to support 0.70 anymore. Hopefully, this gives you some time to plan the migration to the latest version.