Android Studio launches application / test directly if nothing has changed

If nothing has changed since the last compilation and launch, and then I pressed the start button again (green start button), it executes and then starts.

How can I run it directly without compiling the same thing?

+5
source share
2 answers

Maybe I'm wrong, I don’t think, but it is possible when you pass Android Studio, but using the apk assembly and installing it with Android Debug Bridge (ADB), you should get the desired behavior.

When the project compiles, AS creates apk output. Usually this should be specified by app-debug.apk and located in the build/outputs/apk/ folder:

Your .apk file (signed with the release or debug key) is in your build / directory module after creating your application.
cf. Work in the emulator

Using adb , you can install this apk, previously generated (and I believe, without compiling again) on the device using the install command:

 $ adb install -r path/to/app-debug.apk 

After installation, you should receive a command to launch the application. A little research led me to "How to launch an Android application from the command line?" :

 $ adb shell $ adb am start -n my.package.name/my.package.name.MyActivity 

And then you could combine them in one line to launch apk right after installing it. It looks like this:

 $ adb install -r path/to/app-debug.apk && adb shell am start -n my.package.name/my.package.name.MyActivity 

Therefore, the application will work without compilation.

0
source

First, try right-clicking on the project, and then select "Launch Android Application." This will change the default launch application configuration.

If this does not work, try changing its launch configuration by right-clicking on the project in the project explorer and select "Run as β†’ Run configurations".

Always run a project if you open this java tab of a project class in the workplace. You cannot start your project directly by clicking the Green Play button if you opened the XML file for this project. However, you can start a project if you open the manifest of this project.

-1
source

All Articles