Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: run/debug release version of app

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?

like image 251
Paul Verest Avatar asked Mar 13 '15 08:03

Paul Verest


People also ask

Can I debug in release mode Android Studio?

It means you have to give sign build in debug version also in build gradle. So It will have the same sign as release build and you can debug when it runs.

How do I know if build is debug or release Android?

The solution from Illegal Argument is based on the value of the android:debuggable flag in the manifest. If that is how you wish to distinguish a "debug" build from a "release" build, then by definition, that's the best solution.


1 Answers

There's a window called 'Build Variants' where you can choose, which version you want to be installed on your emulator/device.

enter image description here

You also have to add debuggable true to your release build to be able to debug it.

like image 147
carstenbaumhoegger Avatar answered Oct 11 '22 10:10

carstenbaumhoegger