Always run on hardware - android

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.

Related

Don't start virtual device automatically in Android Studio

I usually want to test my apps on a real phone but I still have a virtual device to test the latest stuff not supported by the test phone. My problem is that after plugging in the phone into the USB port it asks for a confirmation to allow access, which I usually forget and so android studio starts the virtual device. Very annoying! Android Studio used to have a run popup where it asked which device to run the app on, but it no longer shows the popup in any of my projects. Can this popup be re-enabled? Or what else can I do (except to delete the virtual device)?
Next to the Run icon in the top toolbar, right, there is a dropdown list where you can select the Run Configuration. Typically it is pointed to 'app'. If you open the drop-down, there is a choice to Edit Configurations. For both Release and Debug, you should look at Deployment target Options:, Target: and select 'Open Select Deployment Target Dialog', and do not check 'Use same device for future launches'. Then click Apply, and OK.

Is there a way to make Android Studio 3.5 remember target device selection?

I frequently run my apps on multiple devices at once. Before the 3.5 update, I was able to do this by cmd-clicking them in the device selection window and checking "use the same selection for future launches". 3.5 introduced this new dropdown in the toolbar to replace that window. Not only does it now try running your app on an emulator if you run it before adb recognizes your device, it doesn't remember anything at all. There is an option to "Run on multiple devices", but you have to select devices every time. This is just so laughably worse than what was before.
Can I either bring back the old device selector or make the new one remember my selection?
I haven't found a way to get Android Studio 3.5 to remember which devices to run but there's a plugin that I use to accomplish this: ADB Idea: Preferences/Settings -> Plugins -> Marketplace.
It has an option to start the app with a checkbox for remembering.
Once you install it, you access it in Tools or use a keyboard shortcut: Ctrl+Shift+A on Mac & Ctrl+Alt+Shift+A on Windows/Linux

Device chooser dialog is not showing up after instant run

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.

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.

Android Emulator

I'd like to choose the emulator to simulate the testing of my android app but when I hit run, eclipse opens a new window with a new emulator. How can I make eclipse run on the emulator that is already open?
Its better to check your run configuration. Check target tab, its sure that your target avd doesn't match your running emulator.
Do one thing, make emulator selection manual instead of automatic. It will let you choose desired emulator or device when there are more than one avds available

Categories

Resources