Device chooser dialog is not showing up after instant run - android

In Android studio 2.0 after first app launch on emulator it seems that run process is attached to it. But if I connect device and want to test app, device chooser dialog is not showing up. I tried instant run, simple run, checked configurations (it's set to show chooser dialog), but all changes are made to emulator app.
How to launch app in device without turning off emulator and losing instant run "**connection**" with emulator ?

This behaviour is clearly a shortcoming that's going to be fixed in subsequent releases, there's an open issue at AOSP.
Right now I found two workarounds that don't require studio restart or killing the adb process:
Force close the app on the device you have the ongoing instant-run session. This way the session will be closed and you will be asked to choose the device after next run.
Press the "debug" button if you've pressed the "run" button before and vice versa. For some reason, changing from run to debug or from debug to run forces AS to close the instant run session.

Till the issue is solved, you can do this.
In the run menu, there is an option as 'Stop app'. Using that you can force stop your app. Running again you will get the device chooser option.
Your app will be present in your earlier device or emulator. You will just have to re-launch it. (If you do not want to run again on the earlier device.)

Go to Run>Edit Configurations > Deployment Target Options and uncheck "Use same device for future"

February 2018 answer:
Try to disable Instant run from the Settings, it worked for me on Android-studio v.3.0.1
Open the Settings or Preferences dialog: On Windows or Linux, select File > Settings from the menu bar. (On Mac OSX, select Android Studio > Preferences from the menu bar.)
Navigate to Build, Execution, Deployment > Instant Run.
Uncheck the box next to Restart activity on code changes.

Go to Task Manager and kill the adb.exe process.
This will detach the android studio with the running emulator.
You can then again run the program and you will see the device chooser.

Instant Run has nothing to do with emulator or devices, it will perform its action on whosoever you have selected.
Just restart your android studio and connect your device and launch app ; Dialog will appear.
When chooser dialog appears showing connected devices and emulators don't check "Use same device for future launches" to get this dialog every time you launch your app.
Also, if you want to run on all devices hold on SHIFT and click each and run.

Related

Android Studio: debug an already running application without restart

Is it possible in Android Studio to debug an already running application without restarting it (assuming the application was previously installed through Android Studio)?
Follow this step (I assume that you have connected device and USB debugging option is turned on):
Step 1 : Click on Attach Debugger option.
Step 2 : Now dialog is open, select the process you want to run.
There is a button1 besides run and debug ones to add debug to your running app. You have to run the debug build to be able to do this.
Yes you can. Just click on the button highlighted in the given image
After clicking this image select the process, running on any attached device, which you want to debug.

How to put auto-run on device off?

I have a phone and when I connect that to my computer and then in Android Studio press "run" it will automatically run on my device. Unfortanetely, I want it to run on an emulator. So I disconnected my phone and pressed "run" again. But now it says: "Error running app: No target device found."
How to put off that it only can run on my device? I have different emulators! When I run other apps made in Android Studio I get a screen where I can choose between my real device and an emulator, that's what I want! Thanks already!
you can go to Run in the toolbar click the General tab then under Deployment Target Options in the Target drop down choose the option to Show Device Chooser Dialog then everytime you run your app you will have to choose what you want it to run on (emulator or device)

How to start start an android emulator in eclipse while a device is connected?

Every time I click "run as an android application" in eclipse, the app only starts on my phone without asking if I want to start it on an emulator as well. I wish to have the app start on both my phone and an android emulator. How would I go about doing this?
Go to menu Window -> AVD Manager and run the emulator from there.
You can also change the run configuration so that it will prompt you for a device (in that dialog you can start the emulator) instead of just using any attached device.
On the Run menu select "Run configurations" then under Android Application find your project. Under the Target tab check the "Always prompt to pick device" option. After clicking Run, and in the future you should get a prompt asking you witch device you would like.

Want option back to choose between running app in device or emulator

I'm learing Android programming with Eclipse. I use to run my applications in either my mobile device or the emulator and it usally pop up a window where I can select which to run, and last time a checked the option to always run this device, so now I can only run it in my mobile device! I just wonder how I could get back the window to uncheck this option to be able to choose between them again? Thanks!
Go to eclipse Run Configurations select you applicaiton, then on the right on the Target tab select the Always prompt to pick device radio button.

Always run on hardware

I do my Android development exclusively on my actual phone, and I want to be able to run my program without having to go through the Android device chooser every time I launch, but even when I check the "Use same device for future launches" box, I still get prompted to choose a device. Do you know what I can do to always run on that device?
Go in to the menu Run -> Run Configuration... and in the configuration of your project, under the tab Target, check and make sure it's set to automatic.
I just tested:
Run Configurations -> Target Tab
Then set Deployment Target Selection Mode to automatic instead of manual.

Categories

Resources