I have followed following tut to install messaging-simulator.apk on my Nexus 7 emulator of adt sdk...
http://www.orhancanceylan.com/installing-and-testing-apk-files-to-the-android-emulator-on-mac/
But, after the device (virtual) is launched (which is annoyingly slow), no further action could be performed from terminal as it gets stuck or no progress is shown. (Basically, I am stuck after ./android command. Nothing can be entered in terminal after that. How do i resolve this?
If you can't type a thing in the terminal - just open a new Terminal window and type it there.
A few tips that will speed up your emulator
Make your emulator as intel x86. and check Use host GPU
Install HAXM from the sdk manager
make the settings like this:
I use mac to develop Android.
Thanks a ton to #Uriel Frankel. Yet, all those tips and tricks given by him did not work out for me due to low memory in my macbook.
So I have used Genymotion emulator(http://techapple.net/2014/05/3-best-android-emulators-for-mac-os-macbook-run-and-install-android-app-on-your-mac-os-x-macbook-airpro/) instead of default android emulator and successfully launched the app by installing it.
You can all try above solution first and if it did not work out, use Genymotion, it's cool :)
Related
I'm unable to debug using VSCode for Flutter. I'm using Windows and I'm trying to use an Android emulator.
I have attempted to reinstall Flutter, Android SDK and VSCode to fix the issue, as well as tried setting environment variables.
This is the error that I get when launching debug mode.
Failed to launch emulator: Error: Emulator didn't connect within 60 seconds
Are there any better emulators that I can use for both Android and IOS, because I don't even know where to begin with IOS emulators. I'm new to app development and want to get started making applications for both devices.
i had same problem,
i tried to stopping emulator based on Answer of Rahul Shukla:
Steps:
Open Android Studio
Tools -> AVD Manager
Virtual Device -> Actions (Refer Image)
Click On Stop
Now Start Emulator
Now it's working fine :)
but it not work for me.
i test another way. i use these steps:
Open Android Studio Tools -> AVD Manager Virtual Device -> Actions
Click On Wipe data
Now Start Emulator and Enjoy it!!
Steps:
Open Android Studio
Tools -> AVD Manager
Virtual Device -> Actions (Refer Image)
Click On Stop
Now Start Emulator
Now it's working fine :)
Adding the following variables to $HOME/.bash_profile solved my problem
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
Open Android studio and go to AVD manager.
Click on stop
Click on wipe data
Click Cold boot
I've added a user environment variable:
Name: ANDROID_HOME
Path: Your android folder path, personally it was D:\Android
and restart.
Hope it ll work for you.
For android emulator there are alternatives like geanny motion.
Since you have AVD installed you could try running from the command line.
run flutter devices to get the list of emulators and their id.
then run (assuming emulator-5554 is you emulator id) flutter run -v -d emulator-5554
Finally you the option of starting android studio then start your emulator,form the IDE and the run the above command or you even run the app from the IDE.
For anyone struggling even after trying with the other solutions. Try:
Quit VS Code
Open your terminal and run adb kill-server
Open VS Code again and attempt to run your app on your emulator.
This is what worked for me. In Android Studio, go to Settings, and select HAXM.
Then go to Tools, AVD Manager, and click on the Play button to start your emulator.
Also, make sure you have enabled Hardware Acceleration in your BIOS, if you have not done so yet. Check this post for this matter:
Error during installing HAXM, VT-X not working
Approach of wiping data listed above worked for me , i mentioned those in steps :-
Steps:
1.Open Android Studio
2.Tools -> AVD Manager
3.Virtual Device -> Actions
4.Click On wipe data
5.Now Start Emulator
6.Now restart the pc
Restarting the pc is not necessary i just did it as a follow-up,
although make sure your android studio is updated because in my case AS was not updated so i think my emulator was not working and VS Code was throwing errors .
Try restarting your PC once! It worked for me!
I had the same issue on Linux. I resolved it by disabling hardware acceleration for the emulator:
Android Studio -> AVD Manager -> Edit emulator -> Emulated Performance: Changed from Hardware to Software.
Update:
It turns out that while Flutter is unable to launch emulators with hardware acceleration, they launch with acceleration just fine from Android Studio or with the emulator command.
As of April 2020 you can override emulator launch commands for Flutter in VS Code.
In VS Code settings you can search for dart.flutterCustomEmulators, or directly populate your settings.json like so:
You can get the emulator ID with the flutter emulators command:
Now when you choose this emulator in VS Code it will use the emulator command from the Android SDK rather than the flutter emulator command it usually uses, and it launches and connects successfully as expected.
Here are the reasons I had
Out of disk space.
Android Studio didn't launch. I immediately started looking for the problem in VS.
You can try to wipe the data of the particular device.
Go to -> Android Studio -> Tools -> AVD Manager -> [Select the down triangle on your chosen device] -> Wipe data.
Now retry.
I am using Genymotion 3.0.2., VS Code (version 1.36.1)
You can read about it here - Using Genymotion Emulator with Flutter in VS Code — (Without Android Studio)
Open up Genymotion and go to the ADB Setting section:
Notice how the default selection is “Use Genymotion Android Tools (default)”? With this selection, the emulator is not recognized.
Change it to “Use custom Android SDK tools”, set the SDK location to where your SDK is (in my case it’s at “C:\Program Files (x86)\Android\android-sdk”). Make sure the tick mark (“This folder is valid”) is displayed.
Close the settings box.
Now reload your “VS Code” IDE.
The problem for me was that Intel HAXM wasn't installed. When I opened AVD Manager through Android Studio and tried to launch the emulator from there (instead of trying through VS Code), it told me that HAXM was required and prompted me to install it. After Android Studio installed HAXM successfully, I could run the emulator from VS Code without any issues.
Just restart the PC, works every time. It is that simple.
Check if it already running. Find qemu-system-x86_64 (or similar) on windows task manager, choose end task. Try launch it again.
Make sure that vt-x is enabled in your bios
For me "wipe data" by going into :
Android Studio
Configure
AVD Manager
Wipe Data
Didn't work.
So I did it the hard way :
Delete the emulator
Create a new one.
You should increase the internal memory of your device.
You need to first install android studio.
Follow these steps (Works for Android Studio 3.5.1)
Choose "Run" in the top menu bar
Press on "Select Device"
Select "AVD manager"
There will be a popup now for creating your virtual device.
For me, it was "Not enough disk space". Generally, in these situations, you can run Android studio then Tools-> AVD manager and start manually.
If there is a issue then you can see the actual in android studio logs.
Mine was similar but for iOS and it said Failed to launch iOS Simulator: Error: Emulator didn't connect within 60 seconds . I closed all instances of VS Code, opened the project again and this time it worked.
I also had the same problem above when i freshly install AVD API28. I tried all posted solutions in this thread and they didn't work for me.
So, I go to android studio --> AVD manager --> Click the green play button(Launch this AVD in the emulator).
then VSCode can detect the emulator and it works fine.
But, I think it will need to run AVD manually every time we wants to use the emulator.
I am encountering the same problem with the emulator that it is not starting and says:
"Emulator didn't connect"
Solution:
Make sure that your virtual technology (Vf-x) is enabled in the bios
setting.
This solves my problem.
For me, this was happening quite often and cleaning cache was a bit hectic for me as I had to download few files again and again.
What I did was, stopped the AVD from Android Studio
Then, I ran flutter run from VS-Code and it worked!
delete AVD and create a new one worked for me.
For some, it might be problem of the emulator and Android API itself.
A duplication of the problem mention in Can launch, but not connect, to emulator in VS Code and Android Studio using flutter.
I sort it using a API 29 instead of 30. Since API 30 (in Pixel 4) skipped the allow debug mode.
Hope it helps for some of you.
It was a storage issue for me. Had to clear up space by deleting junk files and I was able to restart my emulator.
I am using Lenovo V15 laptop.
I chose extreme performance from bios settings. And I encountered this error.
When I select intelligent cooling, the problem was solved.
In a nutshell,
Replace 'extreme performance' with 'intelligent cooling' in the bios.
Follow these steps:
Find qemu-system-x86_64on Task Manager and end task
Open cmd and execute this command adb kill-server
It works for me. Good luck
I am facing this problem when i am starting my emulator from android studio avd manager. it shows the list of my virtual devices. now when i start the emulator. it shows progress to opens and disappeared in a second without throwing/showing any error.
i am using latest android studio version.
system config : Intel core 2 duo
ram : 6 GB
is this problem cause of system config? Please write your answer and feel free to ask.
I had similar issues (the simulator progress would open then disappear) on my Mac El Capital. Downloading the latest HAXM and RE-INSTALLING it fixed.
Download link: https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager
I have updated the video drivers and solved :
1. emulator problem
2. genymotion "player.exe stopped working" problem.
You should use Genymotion replace for default Android Emulator.
There are some various ways to solve this kind of problems:
-> after restarting android studio, if u are facing same problem then try below ones.
kill the adb server through adb shell and then start adb and then launch your emulator.
2.First uncheck Enable ADB Integration and launch emulator and then check Enable ADB Integration.
3.launch your adb and emulator by Debug app from run .
4.maintain the targetSdkVersion corresponding to your emulator
5.uninstall existing emulators and create new one.
delete your adb application and and download new one.
I had this problem because I had many (20) devices saved in my AVD with lots of memory allocated to each (1GB) and my laptop was lower than normal on memory itself.
I cleared out the devices in AVD and started over and it began to work normally again.
I used to launch and debug Android Studio apps on emulator without problems. However, recently I am constantly failing to start the emulator. Updating the SDK and system images did not solve the problem. Updating qemu-system-* did not help either.
System info: Linux Fedora 25 (x86_64), Android Studio 2.2.3
It turned out that the problem was due to the same old NVidia driver problems with Linux. To fix the crash, I opened AVD Manager from Android Studio (Tools->Android->AVD Manager), and then opened the virtual device settings. Then in the Emulated Performance section, next to Graphics, I selected Software rather than Automatic or Hardware. This does the trick and no more crashes occur for the emulator, though it seems considerably slower, than it used to be when Emulated Performance presumably used Hardware by default. The following screenshots will hopefully give a better hint on the solution.
Have you tried running AVD Manager from a terminal?
Control the Emulator from the Command Line
Here you will probably have more details of the errors that make the emulator not work fine.
Delete in your Android SDK the directory "libstdc++" in the directory "emulator/lib64". The emulator will use the system libraries now.
I was fiddling around on an issue like this on Fedora 32 for a couple of days.
I had to to make system unload the free nouveau graphics driver and install/load the non free nvidia driver.
Very useful:
https://rpmfusion.org/Howto/NVIDIA
To check which driver is loaded I used:
lshw -c video
It is difficult to grab the correct rpm package from rpmfusion.
If nvidia is not loaded, then you can check:
more /var/log/messages | grep nvidia
It told me which driver series to use.
After successful install of nvidia driver, I can use HW graphics option in AVD manager.
Sometimes killing the qemu process and then relaunching AVD solves the problem.
killall qemu-system-x86_64
I know this is an old thread but the answer that helped me is not in this page:
The problem was that my mother board had the parameter "CPU virtualization" disabled. After I turned it on, the emulator started working.
I had this problem and I discovered that I did not have enough memory to run my avds. To check this, it is best to try run the avds through the terminal:
First: Check the avds you have installed by changing directory (cd) to the tools folder under the Sdk folder in the Android folder:
//to cd to the tools directory from your home:
cd Android
cd Sdk
cd tools
Once in the tools folder, check the avds installed:
$ ./emulator -list-avds
To launch an emulator listed under your installed emulators:
$ ./emulator #complete_name_of_avd
If you have enough memory, you should be able to start your started avd successfully. If not due to memory issues, you will get the information through your terminal. Free up enough memory from your device to ensure you are able to run the avd successfully.
Also, you might want to reconsider testing an app from the virtual emulator as it drags the machine so much. A physical device connected via USB will be much better to use. just ensure that you have enabled debugging on that particular device and you will be able to identify it among the list of options you have for deploying your application.
None of above helped me. For versions 2021.* and 2022.* just disable ipv6. I have no idea what if you really need ipv6 but only this action solved the problem for me.
Check your Linux distro manuals for details how to disable ipv6.
I have just installed genymotions, but when I try to start my app on it, as described at the end of this paragraph, eclipse starts the old emulator even if the new one(genymotion) is running. I tried to change the debug configuration but the only virtual devices that I can see in target are the old emulators(see the photo below).
If in target i follow this answer, I get the following error :
[2014-01-30 19:50:00 - HelloWorld] No active compatible AVD's or devices found. Relaunch this configuration after connecting a device or starting an AVD.
Moreover I followed the FAQs that suggests how to bing the SDK. I show my configuration in the second photo.
The devices shown in the photo are all made with AVD, there aren't the one of genymotion and neither the one that is running:
Here I put the configurations of genymotion:
How can I say to eclipse to start the genymotion emulator and not the AVD one?
Looking at your screenshot I think you should unselect all the AVDs displayed on the list. The option you chose launches the best selected AVD by default, and optionally a device.
Also, the Genymotion instances are considered as real devices by ADB and ADT. So, as GhostDerfel mentioned, you need to run one of them before running your app on Genymotion instance.
To know all the detected devices by ADB you can look at the "Devices" section of DDMS. If a Genymotion device is detected, it should show a name like this : genymotion-galaxy_s3....
You can also run this command adb devices. The result should show something like this:
List of devices attached
192.168.56.102:5555 device
Each Genymotion machine is listed by its local IP address here.
If you can't find your Genymotion instance(s), check that you have the lastest version of Genymotion. A ADB detection bug has been fixed on the release 2.0.2
I had the same problem, i solved it by closing Genymotion and starting it from Genymotion Virtual Device Manager in Eclipse
i also had this problem and all tried all the above solutions and still was not working.but finally i read in the genymotion manual that u can simply drag and drop ur apk to the device and it will load and run.so i tried that and not only it worked it also seemed to solve the path problem also so that when ever i run the project it will automatically detect my device created by genymotion.
I can resolve by connecting a real device one time.
You need to install the genymotion plugin. In android studio File>Settings>Plugins>Browse Repositories > install genymotion plugin. once installed a genymotion button should appear in android studio.I hope that helpfull for you.
I wanted to try my hand at programming android devices, so I followed the directions from the android website, installed the sdk, the java sdk, and eclipse. My computer is Windows 7 64-Bit, but I have the 32-bit Java SDK and Eclipse installed since hearing that there are issues with the 64-bit versions.
I am running the most recent version of the Android sdk, 4.0 R15.
I believe followed all of the instructions for installation, but when I load up a sample (Lunar Lander in this case), it loads the emulator, but will not install the app to it. ADB does not show the emulator listed when I use "adb devices", the DDMS perspective in eclipse does not detect any device either. In the emulator I have activated the USB debug setting in the developer area.
I have tried restarting the adb server, and have reinstalled a few times.
I even copied what one guy did on a youtube tutorial for a hello world program, and it still would not load to the device.
Does anybody have any idea how to get the emulator and eclipse talking so I can actually run and debug programs?
Try to adb kill-server and then do adb command like adb devices which will start adb again.
It helps in my case.
Best solution I found is this:
Open DDMS(Window->Open Perspective->DDMS)
In DDMS in the left side there is a Devices tab, a little below there is a list of items, choose little triangle called View Menu, under it find Reset adb and launch it.
After that I get my emulator detected.
Create new AVD following Window->AVD Manager->New (Give a name to your device & select the target) -> Create AVD.
Select the AVD that you created and Click Start to launch the devie.
Only on launching, the device is displayed under adb devices.
For starters, I think you can try the 64 bit versions of Java and Eclipse for Windows. I've Windows 7 64-bit edition, 64-bit java and eclipse versions and all work very well, without any glitches. I however have a question. Where exactly have you installed Android? I mean, using the installer that's available in the Android Developer website. If you've installed it in C:\Program Files, then try re-installing it in C:\ directly instead of Program Files directory. I had faced issues when the directory was C:\Program Files and then I changed it to C:\ .
I noticed that if you allocate a lot of memory to the device it can "freeze" when starting, if frozen for a sufficient period it disappears from the adb devices list. Try reduce the memory footprint of the application?