I've recently had to start developing a Micronaut project in Android Studio instead of IntelliJ IDEA Ultimate. I'd assumed that because they share the same base this would be fine but when I load up my project I get this (the project is held in the wsl filesystem and all development has been using WSL with IDEA):
14:07 Project [name] is using the following JDK location when running Gradle:
//wsl$/Ubuntu-22.04/usr/lib/jvm/java-11-openjdk-amd64
Using different JDK locations on different processes might cause Gradle to
spawn multiple daemons, for example, by executing Gradle tasks from a terminal
while using Android Studio.
More info...
Select a JDK
Do not show this warning again
It's unclear why this is happening, when I click 'Select a JDK', what is selected is the JDK installed on WSL that IntelliJ is using, likewise it is pointed at the same directory where my gradle properties is kept.
I'm not sure where to go with this, my guess would be maybe Android Studio is trying to run a gradle or java instance that's not the WSL one (I think it installs it's own alongside) and that's the issue but the settings would imply otherwise. Does anyone know what might be happening?
Thanks!
Edit: tns run android works on android-studio ide but not on vscode. I got it running in android-studio by clicking the configure in the picture below:
I'm new to nativescript and android studio scene and configuring things out is really a hell of an experience, I got this existing project that I got running yesterday and when I try to run it again today with tns run android it now don't see the emulator that I have installed and the same emulator it used to run just yesterday. Here are the details of my config:
Installed Packages:
Path and Environment configuration:
Now if I run tns device android --available-devices this show up:
And it still insist that it cannot find any devices when it just found one!
Running tns-devices can't find it as well:
It also says All is good when I run tns doctor:
So my question would be, what am I missing here? Is it a missing package? Is it a wrong android configuration? Do I have to reinstall android studio from the start (Already did this twice!)
What worked for me:
restarted my unit.
ran the emulator from android studio.
ran tns run android on vscode.
and it just worked. Also, this might help you as well.
This is the image of gradle daemon
This is the version of the android studio
and I have tried to change heap size in the gradle properties but it is not working.
I am really stuck on this issue because any project is not building and even when I was trying to build new project it is also not working.
I update to 4.2.1 on my Mac today, when I open up a project it starts an infinity loop of android studio windows of that project, had to hard restart my Mac.
The only way I was able to fix it, was by going back to 4.1.3.
For solving this problem in windows run this command in cmd.
setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true
and this will work definetly.
I'm new to Android Studios. After trying to press play on my Pixel 3a device emulator on AVD Manager this pops up. Error Message : Unable to locate adb
However my emulator runs just fine, I just can't run the "flutter run" command and the flutter app on the emulator. Emulator
I'm on Android Studios 4.0. Here's what I've tried so far to solve this issue.
AVG Antivirus
I added the adb.exe path in the exception section of my antivirus. AVG Antivirus
Android SDK Location
I went to SDK Manager, pressed edit beside the Android SDK Location box. All SDK components are already updated. Android SDK LocationUpdated SDK Components
SDK Platform Tools
I unchecked and checked SDK Platform Tools on SDK Tools.
Platform Tools
I've tried everything but still no luck. It's been a week and it's getting really annoying. I really do hope someone can help me. Really much appreciate it. Thanks in advance 😊
I've been tearing my hair out about this since I updated to v4.0 about an hour ago! :) This is what worked for me in the end (the other solutions about stopping starting adb server etc. just didn't work at all). YMMV.
Go into SDK manager, and uninstall :
Android Emulator
SDK platform tools
SDK command line tools
Close SDK manager and/or android studio completely.
Make sure the directories for these tools under AppData/ .. /Sdk have all been removed properly. Just zap them if they haven't.
Restart Android Studio and re-install all these packages.
I did another stop/restart after this, just to be sure.
Step 3: Profit!
Seems that upgrading the existing packages maybe didn't work properly, even if AS thought it did.
Still seem to be having issues using the geolocator package now (which was working fine before, so thinking this is setup too), but the emulator is starting OK now with no adb issues.
I tried reinstalling Android SDK after deleting the platform-tools dir but with no success. What did work for me were the following steps:
In Android Studio go to File > Project Structure (Ctrl + Alt + Shift + S in windows);
Under Project Settings>Project>Project SDK must have a valid Android SDK selected;
emulate a new device;
check if the adb daemon is running and recognizes the emulated device: open cmd prompt, run %ANDROID_HOME%\platform-tools\adb.exe devices and it should list the device you have on atm.
If you already have installed the Sdk tools at ~/Android/Sdk, you can add this to your .bashrc or .zshrc, alias adb=/home/USER/Android/Sdk/platform-tools/adb (change USER to your user) and restarting android studio, not invalidate caches/restart but closing it and re-opening it, which should pick the new adb alias from the shell.
The answers didn't work for me. So I removed/uninstalled everything and install a new android studio.
How to remove android studio correcly:
I have been trying to use android studio 2.0 emulator but I can not run my App on the Emulator. When I Run my App it shows the emulator with following details:
Hax is Enabled
Hax ram_size 0x800000000
HAx is working and emulator
runs in fast virt mode.
console on port 5554,
ADB on port 5555
After that it takes to next TAB Launching app and shows
Waiting for the device to Come online
After that it shows error:
Error while waiting for device: Time out after 300seconds waiting for emulator to come online.
What I have tried so far.
Installed fresh android studio 2.0 with all update to date SDK
Tired to increase Emulator Memory.
Installed android studio 2.1 Beta with latest SDK
Discussed this issue on Google.
What's the solution?
I haven't found any solution yet. I opened new issue on 4th may 2016 because it is known bug in previous versions. Please report on the following link if you have same issue.
https://code.google.com/p/android/issues/detail?id=209095
The solution for me was setting the Graphics option on the Android Virtual Device to Software instead of Automatic or Hardware.
I believe this was the solution because I am working on a windows machine that did not have a dedicated graphics card.
You might have forwarding enabled on adb. You can try this: Quit Android studio and launch terminal. Run these commands:
adb kill-server
adb forward --remove-all
adb start-server
Now you can launch Android Studio and try again.
Also something that can go wrong: Make sure you exit Docker for Mac (possibly all other kind of docker installations as well).
My problem went away after I shutdowned VirtualBox on my machine.
One thing I know is that Linux KVM can't get along with VirtualBox well.
I found a workaround even though I am not sure why this is happening.
Go to Menu->Tools->Android and uncheck the option Enable ADB Integration
Run the application. Now the emulator will be launched, but app will not run. Once the emulator is fully launched, check the Enable ADB Integration option and re-run the app. Now the app will be launched in the already running emulator.
Go to Device Manager (Tools -> Device Manager)
Wipe the data of your device and try starting it again.
Go to Android Studio Command Line, and follow these steps:
__> cd /Users/your_root_name/.android/avd
__> ls
__> rm -r Nexus_5X_Edited_API_17.avd There are two avd files.
Rerun the app.
You could try :
run the emulator from the console manually and see whether adb can connect("see") it from android studio. Does it run at all?
delete avd , recreate a new one for testing, always a good idea in 2.0. lot's of stuff is changing ( instant run etc.)
what does adb say from console ? adb kill-server , adb start-server, start an emulator, then adb devices does it list your emulator ?
try to change this solved my issue, you may other graphics options, and change to a lower resolution model
Upgrade to the latest SDK, for the android emulator:
use 512MB RAM
256MB heap
You can leave the default disk space.
I had the same problem. I'm using Android Studio 2.3 and Debian 9.1 Stretch 64 bits.
In my case, the problem was in default settings established in graphics aceleration configuration.
To solve the problem I opened the AVD Manager, then I selected the device and I opened config file (config.ini) selecting "Show on disk" option whitin "Actions" column. Within the file, I changed the value setted in hw.gpu.mode variable from mesa to swiftshader. After saved the changes, the emulator started without any problems.
More options availables could be found on this link.
These are the steps I took (I'm on Linux).
Switched to Software rendering (works but is too slow)
Tried running on commanline and an error displayed.
Forced emulator to use the system graphic drivers.
First, as #jlars62 suggested, I tried using Switching the Graphics to "Software" and this DID work. However, the performance is far to slow so I dug a little deeper.
Then I tried running the device from the console, as #CaptainCrunch suggestion. (My device was created in Android Studio; emulator in the Sdk may be in a different place on your system)
$ ~/Android/Sdk/emulator/emulator -avd Nexus_6_Edited_768Mb_API_23
For me this produced the following error:
libGL error: unable to load driver: i965_dri.so
libGL error: driver
pointer missing libGL error: failed to load driver: i965
...
Which I tracked down (on ArchLinux) to mean it's using the wrong graphic drivers (Android Sdk comes with it's own). You can force the system ones on the commandline with -use-system-libs:
$ ~/Android/Sdk/emulator/emulator -avd Nexus_6_Edited_768Mb_API_23 -use-system-libs
To force Android Studio to do this you can intercept the call to "emulator" like so (See Mike42) :
$ cd ~/Android/Sdk/tools/
$ mv emulator emulator.0
$ touch emulator
$ chmod +x emulator
In the new emulator file add this:
#!/bin/sh
set -ex
$0.0 $# -use-system-libs
I experienced a similar issue with android studio 2.2. Re-installing a new system image didnt resolve for me. Then found this solution on this link.
unchecking the Enable ADB Integration option and checking it back seem to resolve it for me. I hope this helps someone out there.
Android API Version for application and device should match. Check if minSdkVersion and targetSdkVersion in Gradle Scripts - build.gradle (Module: app) correspond device API.
Also low versions (e.g. API 15) result in ide-emulator link failure, inspite of applicatrion and device versions match.
I had the same problem. I removed virtual device and run app on my phone - worked well.
To remove virtual device: Click icon "AVD Manager" in Android Studio, select virtual device and in context menu click "Delete".
Then turn on on the phone "Developer mode". Connect phone via USB to the laptop.
Restarting ADB server works for me, but no need to go for it from command line.
Ctrl + Maj + A -> Troubleshoot Device Connections -> Next -> Next -> Restart ADB Server
Sadly none of the solutions worked for me! I solved my problem by uninstalling existing APK from my phone and it all started working perfectly!
This started happening after I've updated android studio to latest version.
I almost tested all solutions in this topic and other pages. Finally after lots of searching I found the issue!
I had to enable Hyper-V on my system (If your system does not support Hyper-V you need to install HAXM instead).
In this link you can read about enabling Hyper-V and HAXM: https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?pivots=windows
If you install HAXM and still doesn't work go to this link below and install Hyper-V.
Next, restart your computer.
If It doesn't work again remove the emulator and reinstall again with a high API.
https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?pivots=windows
I experienced a similar issue, i fixed it by deleting the Android emulator then created a new one with a higher API level.
In my case I've selected API-30
To fix it I went to Tools > SDK Manager > SDK Tools and updated Android SDK Build-Tools 31
Somebody said they needed to do a cold boot afterword
I encountered the same problem, when I tried to run it from the terminal by following command
~/Documents/development/android/SDK/emulator/emulator -avd Resizable_Edited_API_31
I encountered the following error
qemu-system-x86_64: -chardev socket,port=36201,host=::1,nowait,nodelay,ipv6,id=modem: address resolution failed for ::1:36201: Name or service not known
^C^X^Z
And I realized that I had disabled ipv6 in the system, after I activated it, avd ran for me.
Usually, deleting the current emulator that doesn't work anymore and creating it again will solve the issue. I've had it 5 minutes ago and that's how I solved it.
I have faced the same issue you have mentioned and could solve it by just deleting the current avd and creating a new one.It's working perfectly well now.
This error is gone for me by remove the AVD and create a new one.
after some compile and clean, the error was gone away.