Michael Osofsky
Michael Osofsky

Reputation: 13195

How to install app on device without running it automatically using Android Studio

I need to install an app on a physical device from Android Studio without it starting automatically because I need to ensure the device is completely isolated from all outside networks, etc. when I launch the app on the phone.

I did some research but could only find the following two irrelevant posts:

  1. Installing Android app on device from Android Studio - Irrelevant because it doesn't specifically ask how to install without automatically launching.
  2. Install Android app in Eclipse without running it - Irrelevant because it asks about Eclipse instead of Android Studio.

Upvotes: 8

Views: 2386

Answers (2)

Ramiro G.M.
Ramiro G.M.

Reputation: 477

For those struggling with Flutter, try the CLI:

  1. Compile the apk:

     flutter build apk --debug C:\Users\User1\AndroidStudioFolder\MyApp\app\lib\main\main.dart
    
  2. Install on the running emulator:

     flutter install --debug
    

I already tested it and it works...

Upvotes: 0

Michael Osofsky
Michael Osofsky

Reputation: 13195

I found the answer at https://developer.android.com/studio/run/rundebugconfig#general-tab .

Steps to install app on device without running it automatically using Android Studio:

  1. Go to Run > Edit Configurations
  2. Find the app you want on the left side, for example, a common one is under "Android App" and it's called "app"
  3. On the General tab, find the Launch Options section and under Launch change from the default (which is "Default Activity") to "Nothing"

note: assumes Android Studio Arctic Fox | 2020.3.1 Patch 1

The option "Nothing" is defined as follows in the documentation link above:

Don’t launch anything when you select Run or Debug. However, if your app is already running and you select Debug, Android Studio attaches the debugger to your app process.

Upvotes: 10

Related Questions