Android Studio selects wrong target device: always runs app on first selected one - android-studio

How can I debug other than the first device in Android Studio?
I have two Genymotion devices Nexus 5 and Nexus 6, I can run both successfully but when I try to run/debug app from android studio no matter what device I choose it always runs first selected device.
Initially I thought it is genymotion issue but, it was not the case because same happens if I connect real device. Even though device appears in device chooser dialog but it looks like android studio internally doesn't see it.

Stopping debugging for current device before selecting new device helped me. (Red square)

Here is the solution
First: Go to run configuration in android studio
Then: Select the emulator you want
Finally: Run it

It's a bug in Android Studio, supossedly fixed in 1.5.1 but I have 1.5.1 and the bug is still present. Suggested workaround from Google dev is to "close the debug tab once it is done":
https://code.google.com/p/android/issues/detail?id=195167

Related

Android Studio Emulator no more considering Swipes on Notebook Touchscreens as Input

I upgraded to Android Studio Bumblebee 2021.1.1 and realized that I cannot fully control the emulator with the touchscreen of my notebook anymore. Press events on the touchscreen (like mouse clicks) are still recognized correctly, but when I swipe nothing happens in the emulator.
Unfortunately, I did not note down the previous version of Android Studio that I had installed before, but with previous Android Studio versions I was always able to fully control the Android emulator via the touchscreen (as if I was actually testing my app on a real mobile phone).
My Google searches did not show any results related to this issue. Does anyone have an idea what the root cause could be and if it is possible to fix it?
Disabling launch in tool window in Settings::Tools::Emulator fixed it for me (requires emulator restart to take effect).
Credits to YuriBlaise on reddit

How to run Android Studio emulator on M1 Mac?

I'm having a devil of a time using the Android Emulator on my new M1 Mac. My Android project compiles fine, and I can run it on a hardware device. But I'm not able to run it on the Emulator.
I followed instructions carefully, and set up an arm64-based emulator running API 31. When I press the "Run" button in Android Studio, the emulator opens and boots normally. However, Android Studio is never able to launch my app on it. I see a message "Waiting for all target devices to come online", and that's it.
I have of course tried restarting the emulator, restarting Android Studio, rebooting my computer, and wiping the data from the emulator. I have also made sure that Developer mode is enabled in the emulated Android environment and "USB Debugging" is turned on.
Another suggestion I saw was to un-check "Enable ADB Integration" in Android Studio. This option doesn't exist in my copy of Android Studio, although I did some further research and found that it is now called "Use libusb backend" instead. It is unchecked by default. I tried checking it anyway, and that didn't help.
I'm at a loss as to what to do next. I really need to be able to test my app in the emulator as my inventory of physical devices is fairly limited.
Thanks,
Frank
Download Android Studio Preview, create emulator (API 30 or S), now you can use emulator on both preview or stable Android Studio.

android studio is not able to recognize my device

I am using Flutter for developing my android apps but for some my android studio is not able to recognize my device even though my device is detecting that fully. Is there a way to fix this?
And also for the record, I have tried all the possible methods available on stack overflow and internet like Enabling USB debugging, MTP Transfer, Installing universal USB Driver.
Some phones like OPPO, VIVO, etc is having an extra drivers. It will be shown when you connect your phone with pc. You have to install that driver too. Also check whether this phone is working with another computer or any other phones works in your computer too(to check both your phone and PC is ok). Also check in normal android app development instead of flutter, like checking your phone connection in android studio with java or kotlin.
if all this didn't works then install Visual Studio Code and check the same thing it it. may be this is some issues in Android studio. please inform the details here after all this.
Go to file> Invalidate cache/Restart > click invalid cache and restart button in android studio.
Then run.
If still cannot connect device:
goto file>settings> appearance & behaviour > Android SDK > sdk tools >deselect android sdk platform tools > apply>ok.
It installed the requested components.
then goto app > edit configuration> uncheck allow parallel run in right corner>ok

android studio emulator not selectable

I want to start coding with flutter, so i decided to download android studio.I created an avd called "Pixel 2 API 28" with android pie. When i want to select the pixel 2 as the avd device, the programme tells me that theres no avd, but on the right i can see the avd i created. When i put my cursor on it, it says "not applicable for the main.dart configuration". i have HAXM installed and Hyper-V is disabled, but i also tried it with both being active. I used the default code, which appears when you launch android studio.
Please help!!!
Edit:
I somehow managed to select it now, but i get this error: Running multiple emulators with the same AVD is an experimental feature. Please use -read-only flag to enable this feature.
Try starting the emulator from avd and then check if the device is showing up there if not try running
flutter devices
If the device shows there you can try running
flutter run -d <your-device-name>
You can also check whether the android sdk is configured with flutter try running
flutter config --android-sdk /path/andriod/sdk
hope it helps
Close Android Studio and Run again as Administrator
This is Only the solution i got after working hard for 3 days.

Android Studio 3.3.1 Emulator bug

I'm a new Android Studio user, but I've already done something in the last few days.
I have only a problem with the emulator. I tried to run my code with a normal Virtual Device, but every time I always got the same error:
Emulator: emulator: ERROR: x86 emulation currently requires hardware acceleration!
Emulator: Process finished with exit code 1
I tried to find a solution in the internet, and I found that the problem was my computer (it is an AMD) and I had to download the "armeabi" version when I created a new virtual device.
It worked (I have no more errors), but my emulator is always black and I cannot see anything. I was forced to use Debug USB on my personal phone, to plug in and use it (and it works) but I'd like to solve the problem with the Android Studio emulator. My Android Studio version is 3.3.1, the latest.
Obviously when I have a preview clicking on the file "activity_main.xml" I can see the right output.
Normally I use Nexus 5 and I've tried with Marshmallow and Nougat.
Increase your VM Heap & try it again.
Tools -> Android -> AVD Manager.
Select a virtual device and click on its pencil icon (edit)
Click on Show Advanced Settings.
Under "Memory and Storage" change "VM Heap"
If above is not helpful, Please Check "Wipe user data" in the Launch Option
Go to Android Virtual Device Manager->Select your device->Start->Check "Wipe user data"->Launch
make sure that Intel x86 Emulator Accelerator is active

Resources