Android Studip Run 'app' as Release

May 16, 2019

To Run Release build in Android Studio, click on Build Variants (Left-lower corner), change to release build.

or Android Studio -> Build -> Select Build Variant...

Android Studio Build Variant

NOTE: You might want to set debuggable true to build.gradle (Module:app) to enable logcat logging.

NOTE: Sign build with release key.

android {
    // sign with release key
    signingConfigs {
        config {
            keyAlias '***'
            keyPassword '***'
            storeFile file('***.jks')
            storePassword '***'
        }
    }

    buildTypes {
        debug {
            // sign with release key
            signingConfig signingConfigs.config
        }
        release {
            // enable logcat logging
            debuggable = true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            // sign with release key
            signingConfig signingConfigs.config
        }
    }
}

If you bump into the following error

05/16 16:26:05: Launching app
The APK file D:\android\Travelopy\app\build\outputs\apk\release\app-release.apk does not exist on disk.
Error while Installing APK

Make sure Android Studio -> Run -> Edit Configuraion

or at the top toolbar, on the left side on run (play) icon, which is app, click the drop down for Edit Configuraion

At Before launch section, add Gradle-aware make if doesn’t already exist.

NOTE: When prompted for Select Gradle Task, leave it blank and click OK.

Android Studio Gradle Aware Make

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.