问题
I have added gradle build to Android app, and can launch from Android Studio.
gradlew build
produces debug and released (signed, minified with proguard) versions.
buildTypes {
debug {
zipAlignEnabled true
versionNameSuffix "-" + buildDateTime()
}
release {
minifyEnabled true
// Eclipse project.properties # proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
zipAlignEnabled true
signingConfig signingConfigs.release
versionNameSuffix "-" + buildDateTime()
}
But when I adb install
on device the release version it crashes on start.
How can I run/debug release version of app from Android Studio to find exact place of problem?
Or can I debug manually released signed apk in Eclipse?
回答1:
There's a window called 'Build Variants' where you can choose, which version you want to be installed on your emulator/device.

You also have to add debuggable true
to your release build to be able to debug it.
回答2:
If you are using version 0.14.0 or higher of the gradle plugin, you should replace "runProguard" with "minifyEnabled
" in your build.gradle files.
minifyEnabled false
minifyEnabled false Means Build Type names cannot be main or androidTest (this is enforced by the plugin), and that they have to be unique to each other.
来源:https://stackoverflow.com/questions/29027643/android-studio-run-debug-release-version-of-app