Closed AamirHafiez closed 1 year ago
this is happening to me as well and i can't wrap my head around trying to fix it. My project is production ready but release crashes on launch. It's been many days already trying to find a workaround without success.
Managed to solve this issue -
What worked for me is
Remove these from app/build.gradle:
bundleInDevDebug: true,
devDisabledInDevDebug: true,
hermesFlagsForVariant: {
def v -> v.name.toLowerCase().contains('release') || v.name.toLowerCase().contains('dev') ? ['-w'] : []
},
deleteDebugFilesForVariant: {
def v -> v.name.toLowerCase().contains('release') || v.name.toLowerCase().contains('dev')
},
but kept only:
project.ext.react = [
enableHermes: true, // clean and rebuild if changing
]
Was missing this import on top of app/build.gradle:
import org.apache.tools.ant.taskdefs.condition.Os
Upgraded react from 0.70.2 to 0.70.6 according to the below issue: https://github.com/facebook/react-native/issues/35210#issue-1436785719
Also Removed these lines from build.gradle:
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
configurations.all {
resolutionStrategy {
// Remove this override in 0.65+, as a proper fix is included in react-native itself.
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
And atlast cd android && ./gradlew clean invalidate cache re-build
https://medium.com/@devesu/react-native-android-release-build-crash-on-device-14f2c9eacf18
this solved issue for me, there was an issue with assets in drawable😊
@AamirHafiez, thanks for your info! Worked for 0.69.x also. Updated from 0.69.3 to 0.69.10, and the app crash on Android 14 went away.
Description
Hi, Require help.
I had upgraded react native from 0.66.4 to 0.70.6 and hermes enabled but when launching on any device I am getting the below error in logcat.
Error
android/app/build.gradle
android/build.gradle
Version
0.70.6
Output of
npx react-native info
System: OS: macOS 12.6.2 CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Memory: 26.61 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.9.1 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.19.2 - /usr/local/bin/npm Watchman: 2022.10.03.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0 Android SDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9014738 Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild Languages: Java: 11.0.16.1 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: Not Found react-native: Not Found react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
Have upgraded from 0.66.4 to 0.70.6
Snack, code example, screenshot, or link to a repository
N.A.