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

2

8

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.
Vertebra answered 20/1, 2022 at 23:28 Comment(0)
V
10

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.

Vertebra answered 20/1, 2022 at 23:28 Comment(0)
C
0

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...

Coated answered 12/6, 2023 at 22:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.