When running the emulator on Flutter in Android Studio adb.exe exists in AppData\Local\Android\Sdk\platform-tools, but I get an error saying "Unable to locate adb."
Also, pressing the "Open Android Emulator: ~" button causes the following error:
Error Opening Emulator
emulator: ERROR: Running multiple emulators with the same AVD is an experimental feature. Please use -read-only flag to enable this feature. .
What should I do?enter image description here
That alert comes up very often but the emulator starts up nevertheless. If the emulator doesn't start, click the down button(next to the play button for your emulator in the AVD manager) and select stop/disable to stop the process and try again.
I ran into this while running Cygwin on Windows with a repo I'd cloned using the Cygwin git. It looks as if Flutter launches things differently from regular Android Studio.
I was able to solve this with:
cd \users\(me)\AppData\Local\Android\Sdk\platform-tools
chmod -R u+x *
(That's the Cygwin /usr/bin/chmod on my path.) After that, adb started in a Flutter project.
Related
I'm working on an Android App in Android Studio.
After updating Android Studio to Bumblebee 2021.1.1 Patch 2 it has stopped working.
Now I get the following error:
Installation did not succeed.
The application could not be installed.
List of apks:
[0] 'D:\Filer\Dokument\...\app\build\intermediates\apk\debug\app-debug.apk'
Installation failed due to: ''cmd package install-create -r -t --user current --full --dont-kill -S 4617721' returns error 'Unknown failure: cmd: Can't find service: package''
Retry
Failed to launch an application on all devices
Any ideas how to solve this?
The problem is most likely with the Android Emulator in Android Studio.
If you do a Cold Reboot of the Android Emulator it will most likely solve your problem.
Open the Android Studio Device Manager from Tools -> Device Manager.
Close the Android Emulator if still running.
Click on the Android Emulator's Device Menu ▼ located on the right hand side in the Device Mananger and Choose Cold Boot Now.
Now, try to run the app again...
I have an AVD that I created in Android Studio, here are the details of it:
When I run ionic cordova emulate android in my ionic project, I get this error:
ANDROID_HOME=/Users/joshterrill/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home
Error: No emulator images (avds) found.
1. Download desired System Image by running: /Users/joshterrill/Library/Android/sdk/tools/android sdk
2. Create an AVD by running: /Users/joshterrill/Library/Android/sdk/tools/android avd
HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver
[ERROR] An error occurred while running cordova emulate android (exit code 1).
When I run this command: ~/Library/Android/sdk/tools/android list avd I get this:
Joshs-MacBook-Pro:~ joshterrill$ ~/Library/Android/sdk/tools/android list avd
*************************************************************************
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
*************************************************************************
Running /Users/joshterrill/Library/Android/sdk/tools/bin/avdmanager list avd
Available Android Virtual Devices:
Joshs-MacBook-Pro:~ joshterrill$
So it doesn't show that I have any there.
Also, here's a screenshot of Android Studio which shows that my SDK is currently installed in the same place that I'm looking for the AVD:
Any ideas on why the AVD isn't showing up? I understand that the first error shown from the emulate command gives me the ability to create an AVD from the command line, but I'm going to need to create various AVD's from Android Studio and need to figure out why the terminal doesn't see them.
The answer to this problem was having the correct information in my $PATH. Here's what ended up working for me:
export ANDROID_HOME=~/Library/Android/sdk
export PATH=${PATH}:/Users/mylaptop/Library/Android/sdk/platform-tools/adb:/Users/mylaptop/Library/Android/sdk/platform-tools:/Users/mylaptop/Library/Android/sdk/tools
Can I run android emulator without an android phone? I have installed android studio and I've already installed android virtual device. However, when I try to run it, it gives an error like this :
Couldn't start project on Android: Error running adb: No Android
device found. Please connect a device and follow the instructions here
to enable USB debugging:
https://developer.android.com/studio/run/device.html#developer-device-options.
If you are using Genymotion go to Settings -> ADB, select "Use custom
Android SDK tools", and point it at your Android SDK directory.
I just want to see the emulator in my pc without usb. I have an iPhone but it just shows up in my phone not in my pc using expo scan barcode. I don't want to do that because in my opinion it's not comfortable for debugging etc. I am using windows in my pc so I can't use iOS for emulator.
how to run expo android emulator on windows?
Yes you can:-(With zero android studio config)
Install expo-cli globally.
Install android Studio.
Create a project by running expo-cli init
No need of any configuration on android Studio.
Open existing Project from android studio
then Open the created expo Project it will be available as an android project with a
android logo on it
then open the AVD Manager
Download and install whichever device you want but see to that its above android N
and do it for x86
after Installing the desired emulator
run the emulator before running the project
then run expo start to start the Project
Go to the metro builder and say run android
if it doesn't run on the first go or if you get error close the project
from emulator from recents and do a run on android again from metro
builder don't close project just the running project from recent on emulator
then it should work
Maybe too late, but I found out that is simplier that what you think.
Install your Android SDK (studio)
Create new emulator: Go to Tools > AVD Manager > Create new virtual device
(I chosen Nexus, Android 7)
When you get new emulator installed try to find out list of it ( command: emulator -list-avds )
!! If you do not have emulator in the path follow this commands in PowerShell:
PATH = %PATH%;C:\Users\[YOURUSERPCNAME]\AppData\Local\Android\Sdk\platform-tools
PATH= %PATH%;C:\Users\[YOURUSERPCNAME]\AppData\Local\Android\Sdk\emulator
PATH= %PATH%;C:\Users\[YOURUSERPCNAME]\AppData\Local\Android\Sdk\tools\bin
Run your emulator: emulator -avd [NAMEOFYOUREMULATOR] from the command emulator -list-avds
When emulator runing go to your Expo root folder (wher package.json is) and run npm start
Click on run in Run on Android device/emulator
Enjoy coding
Edit for Linux users
my linux usecase is as follow:
Install Android studio and open it
Install any emulator using AVD manager and try it's working
Close studio and go to your android folder ~/Android/Sdk/(two options 'emulator/' or 'tools/'), basically you need to find emulator
list item ./emulator -list-avds
choose your emulator and run it ./emulator -avd <any emulator>
if emulator not work use sudo
if you do not get any options in Sdk folder but you installed emualtor than you did it propably as a superuser - then the easiest is to completely remove all android studio and install it again
Delete the directory C:\Users\Rizwan.expo\android-apk-cache and opening the project on android again
It will run
There is another way to solve this problem. Follow the steps below in the same order:
run expo start to start the Project
Wait for the metro builder to be displayed in the browser.
On the terminal, wait for all options to be displayed, like so: To run the app with live reloading, choose one of:
Now load a device from Android Virtual Device in Android Studio (which already has the folder containing expo project open). On the terminal, press the key a.
Then the app should now open on the device being emulated.
I am getting this type of error
error: could not install smartsocket listener: cannot bind to
127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048) 1:34:26
PM could not read ok from ADB Server 1:34:26 PM * failed to start
daemon * 1:34:26 PM error: cannot connect to daemon 1:34:26 PM
'C:\Users\MITESH
SUTHAR\AppData\Local\Android\Sdk\platform-tools\adb.exe,start-server'
failed -- run manually if necessary 1:38:14 PM Unable to obtain result
of 'adb version'
my genymotion device is running but it shows me that no device
I came across the same error. I provided the below command and the issue got solved.
COMMAND :- taskkill /f /im adb.exe
Close Eclipse or Android Studio if either is running (Optional).
Open Command Prompt.
Go to the Android SDK platform-tools directory.
Type adb kill-server.
Type adb start-server.
If no error message is thrown while starting ADB server, then adb is started successfully.
OR
Go to Task Manager, open the Processes tab, and end the adb.exe process.
Then restart Android Studio.
This may work if there is any problem with adb.
In my case, none of the above solution worked. I solved it strangely maybe it can be a bug.
Do not run Genymotion emulator before Android Studio. Firstly, I opened android studio then I clicked run project and select deployment target windows appeared. Then I run genymotion emulator and now the emulator is shown in the select deployment target windows in Android Studio. Then deployed to the emulator without errors. Done!
As another way, you can try to set Genymotion sdk to the same as Android studio sdk. To do this, first find your sdk location. You can find it by right clicking the Android Studio project -> Open Module Settings-> Select SDK location -> under Android SDK location, it is shown. Then open Genymotion -> Settings -> ADB tab -> Click Use custom Android SDK tools radio button -> navigate to SDK folder used by Android studio -> Restart Genymotion virtual device
If none of the above worked for you, just make sure that you have closed Genymotion emulator as it caused this issue with me.
Easiest Way! I just ran into this issue trying to connect a React-Native App to an Android Studio emulator. If you read the error message it tells you that "Only one usage of each socket address (protocol/network address/port) is normally permitted." So you can assume that something other than React-Native is also attempting to connect to the emulator.
Terminate The Connections:
Leave the emulator running.
Close out of and uninstall any Android Studio/Eclipse Apps you have on the emulator. This terminates apps trying to connect.
Close Eclipse or Android Studio if either are running. Android Studio doesn't have to be open in order for the emulator to work (This is important). This terminates software trying to connect.
After doing so I went back into my React-Native App and connected to Expo no problem.
All you have to do is terminate all connections. However you so choose.
I came across the same error, it worked simply after restarting the AS on windows, of course, it asked for SDK update.
Android Studio 4.1.3 with API 30 installation has this error
01-04-2021
09:56 'C:\Users\ranja\Android\Sdk\platform-tools\adb.exe start-server' failed -- run manually if necessary
Tried C:\Users\ranja>adb start-server
daemon not running; starting now at tcp:5037
**could not read ok from ADB Server
failed to start daemon
error: cannot connect to daemon**
Note: I have added 'C:\Users\ranja\Android\Sdk\platform-tools' in %PATH% environment variable on Windows 10
i've encountered same error in my ionic 2. i just uninstall and reinstall ionic. and it works fine again..
npm uninstall -g ionic
npm install -g ionic
I am building an app with NativeScript, where I run:
$ tns run android --emulator
to build the app and launch it in an emulator. When I do this, the default android emulator boots on my machine, which is unusably slow...
In all the demos, they are using the Genymotion Emulator. I have installed this, but the NativeScript command still launches the default emulator. How do I get this to launch on the genymotion emulator?
NB: I am using Windows 10
Update:
Even if I run the command with the Genymotion emulator running (and nothing else), I get the following log output and a new terminal window is opened running android-sdk/tools/emulator-arm.exe
BUILD SUCCESSFUL
Total time: 11.959 secs
Project successfully built.
Using C:\Users\George\Source\Repos\NativeScript-App\Bluetooth\platforms\android\build\outputs\apk\bluetoothdemo-debug.apk
Starting Android emulator with image Xamarin_Android_API_23
That looks as though it is referencing the emulator I had been using when I was developing with Xamarin. Any ideas where I can change that, or why that is being called?
start Genymotion, then start one of the devices that you have setup in Genymotion
then check that the device is seen:
$ tns device
then run nativescript like so
$tns run android --geny 192.111.222.33:555
(or whatever is the name that you get from the tns device command)
To my experience --emulator always tries to start the stock emulators. Try to start genymotion and then just tns run android (w/o the --emulator option).
I think it does that when there is no emulator running.
Try starting Genymotion first, launch the image you want, then run the "tns run adroid" command.
I had a similar issue.
To use GenyMotion by default, first delete all the Android emulators using
android avd
I then followed the solution on this thread:
React-Native, Android, Genymotion: ADB server didn't ACK
Edit the settings in GenyMotion to use the android SDK you downloaded. (path for Windows is Users/YOUR-SYSTEM/AppData/Local/Android/android-sdk)
You still have to run the device on GenyMotion before running the emulator
tns run android