Android studio - deploy the release apk instead of debug

AndroidAndroid Studio

Android Problem Overview


The run configurations in Android Studio only let you deploy the default (debugging) APK, but I have built a release APK by running gradle assembleDebug from within Android Studio (as an external tool) and would like to deploy that instead. But it doesn't seem like you can change the APK which Android Studio installs. There is an option to deploy a custom artifact, but I'm not sure what that is, or if it would help, and anyway, there doesn't seem to be an option to create a new artifact in the Android Studio Project Structure dialog.

Does anyone know how I can specify the path of the APK which Android Studio deploys? I know I can install from the command line with adb, but it would speed things up if I could just click a button. Thanks.

Android Solutions


Solution 1 - Android

On the left should be a "Build Variants" tab. There you can switch between your build types. If there no tabs visible than look left buttom for a monitor symbol and click it. Then you should find the build types. The selected one will be installed.

Solution 2 - Android

Click the Build Variation tab on the far left side. If it is not there, press the monitor icon in the far left corner (the darker gray area):

Monitor Icon

In the build variation tab change from debug to release by clicking the list item.

Build Variation

Solution 3 - Android

Run a command

./gradlew assemble<variant_name>
//for example
./gradlew assembleRelease

[package aar]

After success build you can find .apk file at

project_path/app/build/outputs/apk/<variant_name>/
//for example
project_path/app/build/outputs/apk/release/

or just install via adb

adb install apk_path

Read more here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionjoe_deniableView Question on Stackoverflow
Solution 1 - AndroidnenickView Answer on Stackoverflow
Solution 2 - AndroidAutomaticoView Answer on Stackoverflow
Solution 3 - AndroidyoAlex5View Answer on Stackoverflow