Android Studio: run/debug release version of app

白昼怎懂夜的黑 提交于 2019-11-29 12:25:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!