batu dan
batu dan

Reputation: 151

Apk crashes when Release mode but in debug mode works perfectly

I have get apk with release mode, but app crash.but apk with debug apk is not crash this is my android/app/build.gradle

signingConfigs {
    debug {
        storeFile file('debug.keystore')
        storePassword 'android'
        keyAlias 'androiddebugkey'
        keyPassword 'android'
    } } 
   buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }
    release {
        // Caution! In production, you need to generate your own keystore file.
        // see https://facebook.github.io/react-native/docs/signed-apk-android.
        signingConfig signingConfigs.debug
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    } }

my react-native version is "react-native": "^0.62.2", and

ext { 
  buildToolsVersion = "28.0.3" 
  minSdkVersion = 16 
  compileSdkVersion = 28 
  targetSdkVersion = 28 
}

Upvotes: 1

Views: 1980

Answers (1)

Anton Malyshev
Anton Malyshev

Reputation: 8861

Usually that's related to proguard obfuscation, you can check that commenting out the following lines:

   minifyEnabled enableProguardInReleaseBuilds
   proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"

if that helps - you'll need to adjust somehow proguard-rules.pro avoid renaming some classes.

To find what exactly causes the crash debug using adb logcat command (or just look at the "Run" window in Android Studio).

Upvotes: 0

Related Questions