Monday, January 29, 2018

android - debug-apk work fine but sign apk release crash on main acitvity



debug apk run fine but release sign apk crash on main activity checked everything . don't know where is the problem.[build.gradle][1]



android {
compileSdkVersion 28
defaultConfig {
applicationId "com.newtrendsdeveloper.unorthodox"
minSdkVersion 19

targetSdkVersion 28
versionCode 51
versionName "4.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true

proguardFiles 'proguard-rules.pro'
}
debug {}
}



flavorDimensions "color"
productFlavors {
blue {}
green {
applicationIdSuffix ".test"

versionNameSuffix "\"4.0-Microsoft Windows [Version 10.0.17134.407]\n" +
" (c) 2018 Microsoft Corporation. All rights reserved.\n" +
" \n" +
" C:\\Users\\HP\\Downloads\\Tusky-master\\Tusky-master\\app>\";" + getGitSha()
}
}

lintOptions {
disable 'MissingTranslation'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
androidExtensions {
experimental = true
}
testOptions {
unitTests {
includeAndroidResources = true

}
}


}



ext.supportLibraryVersion = '28.0.0'
ext.daggerVersion = '2.19'



// if libraries are changed here, they should also be changed in LicenseActivity

dependencies {
implementation('com.mikepenz:materialdrawer:6.0.enter code here9@aar') {
transitive = true
}


Answer



Most probably it's the minifyEnabled true in your gradle file.



This removes unused code and obfuscates the code. So you can check what is the crash log, probably it's a class not found or null pointer exception. Check what is missing, and then in the build output you can search for a file called usage.txt. This includes all the things that were removed, and you can make sure it is being removed. If it is, then modify the proguard rules to keep that class.



You can check the documentation to understand more about proguard:

https://developer.android.com/studio/build/shrink-code



Of course another way to check if this is the issue is just to change the minifyEnabled to false and try again. If that works, then you can turn it back on and figure out what is causing the problem.


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...