92

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.

joe_deniable
  • 2,562
  • 3
  • 28
  • 38

3 Answers3

157

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.

Community
  • 1
  • 1
nenick
  • 7,340
  • 3
  • 31
  • 23
  • 6
    @nenick Sorry, I don't see that. Where is that BuildVariants Tab supposed to be? – Radu Jan 27 '15 at 14:29
  • 5
    when it is not visible, look for a small monitor symbol located left bottom corner oat Android studio. When you click it then the build variants tab should be visible on the left not far above the monitor symbol. – nenick Jan 28 '15 at 06:50
  • 1
    Just want to add (this confused me) that even if there is no [V] dropdown button, just click on the selected build type to get the menu! Great Answer! – Hack5 Apr 06 '17 at 06:50
  • 1
    on Android Studio 3 if you don't find Build Variants you can make it appear clicking on View->Tool Windows->BuildVariants – Antonino Mar 02 '18 at 05:25
65

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

Automatico
  • 12,420
  • 9
  • 82
  • 110
12

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

yoAlex5
  • 29,217
  • 8
  • 193
  • 205
  • this produces an `app-release-unsigned.apk` which can't be installed without adb, anyway to install a release without adb? – eri0o Jan 27 '21 at 00:16