Eclipse, adb, and ddms not detecting Android Emulator - android

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?

Related

Cannot start Android device emulator on Linux

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.

Installing apk on emulator in mac

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 :)

Visual Studio Android Emulator won't run application

I recently got into Xamarin development. I have a lot of experience in Xcode making iOS apps and the iOS side was very straight forward. Now I'm trying to implement Android. I downloaded a Hello World example to get my bearings. When I run it I have no problems getting the simulator to show up (MonoForAndroid_API_10 and MonoForAndroid_API_12) but the actual application doesn't run, and does not show up anywhere on the simulator. Essentially whenever I use run or run with in Xamarin on Android, it pulls up a fully functioning, albeit empty simulator.
How do I get my application to run on the emulator?
Like the other commenters, this is most likely just a symptom of slow emulator on your machine. I'm running Xamarin-Android development on my 2010-era OSX machine in mavericks with 8GB RAM, and it is slow-slow-slow, but usable. Try to find the Intel x86 speeds improvements (look for HAXM) and you will find that the emulator will be much much faster.
And yeah, get a real handset and plug it in to your computer: always much faster than emulation.
later edit Get Genymotion for Mac OSX or for PC/Windows or PC/Linux. It's way way way faster than the other emulators. I have since found that this is as fast, or faster, than running the App on my connected Android phone. It's certainly simpler in not having to have the device plugged into one of my USB ports, and allows me to code and test on the train. http://www.genymotion.com/
Don't know if my issue was the same but finally this troubleshooting helped me to run emulator https://msdn.microsoft.com/en-us/library/mt228282.aspx#ADB.
I was missing key Android SDK Tools with string value Path in registry Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node
I've created it manually and it worked.
UPDATE
Before I got the issue with running emulator, I couldn't see it in Visual Studio. The reason was I've installed VS Android Emulator through standalone installation, not through VS Installer. It had to be installed there as well.
I had the similar issue, and then I deleted the existing device simulator and reinstalled again and it started working.
As I use a different SDK, in my case
Go to Tools > Options > Xamarin and set the Android SDK path.
Sometime Visual Studio changes this configuration;
2020 Update:
I followed the most voted comment, however, with Visual Studio 2019 updated recently, the steps have changed a little. Here is what previously worked:
WHAT WORKED BEFORE
"Don't know if my issue was the same but finally this troubleshooting helped me to run emulator https://msdn.microsoft.com/en-us/library/mt228282.aspx#ADB. I was missing key Android SDK Tools with string value Path in registry Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node
I've created it manually and it worked."
WHAT TO DO INSTEAD
Nothing. Don't mess with the path.
WHAT WORKED BEFORE
"Before I got the issue with running emulator, I couldn't see it in Visual Studio. The reason was I've installed VS Android Emulator through standalone installation, not through VS Installer. It had to be installed there as well."
Previous instructions image
WHAT TO DO INSTEAD
a. Go to Tools located at the top of the VS window, Get Tools and Features, go to Individual components, using the search tool in the pop up box, search "emulator", once you get the result, make sure both Google Android Emulator (API Level 25)(local install) and Intel Hardware Accelerated Execution Manager (HAXM) (local install) are both checked.
b. Close the solution(s) and restart VS then reopen the solution(s).
c. To deploy the app on the emulator, click Start button to spin up the emulator, left click on your Android project, then click Deploy. You should be able to see your app on your emulator's app menu.
Updated Instructions image
Worked for ME
Sometimes you close the android Emulator but not POWEROFF the Emulator.
this problem happens when emulator shutdown un-properly.
Restart Your EMULATOR
First start your emulator
Then restart your emulator by pressing down the power button and select restart option in your android emulator.
I enabled Hyper-V acceleration based on microsoft documentations: https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?tabs=vswin&pivots=windows#accelerating-with-hyper-v
Basically you need to turn on these two windows features from the control panel (Turn windows features on of off):
Hyper-V.
Windows hypervisor platform.
then from visual studio go to: Tools >> Android >> Android SDK manager >> Tools >> make sure that "Android emulator" version is 27.0.1 or higher, if not, you will find in the same screen a button below to update it.
I did this on windows 10 64-bit, with VS 2017 Community 15.9.5

Android Device Disappearing

I have installed the Android SDK and plugin for Eclipse and written my first test app. I am trying to view the device in the DDMS section of Eclipse, but my Android Virtual Machine is usually not listed in the Devices section when it is running. Occasionally it will appear for a minute only to disappear again. I found an article recommending that I run adb kill-server to get it to restart and appear. This works about 50% of the time, but the device just disappears again in 10-60 seconds.
My main desire with this is to push some files to the sd card on my Android Virtual Machine, but the device doesn't stay visible long enough to push any data to it.
Thanks!
I have found that if my Android mobile is connected via USB then a running emulator may be hidden.
Alternatively, if you mean the devices list in Eclipse 'Run As' then it is possible the 'target version' of your android project in eclipse is set to a higher SDK version than the version of the emulator you would like to deploy to.
The 'target version' is set in 2 files, both of which can be viewed in the root of your eclipse project:
default.properties
AndroidManifest.xml
E.g. to include Android emulators from 1.6 upwards you should find the following in default.properties:
target=android-4
and the following in AndroidManifest.xml
<uses-sdk android:minSdkVersion="4"/>
To edit default.properties right-click the eclipse project/Properties/Android then select the lowest installed version of the Android SDK.
To edit AndroidManifest.xml double-click on the xml file and on the first tab set the 'Uses SDK' 'Min SDK version' to 4.
It happens to me from time to time. I just reopen the emulator and it works.
If the AVD disappears very fast I would try pushing files using adb.
adb push <local> <remote> - copy file/dir to device
I had similar problems with Eclipse launching my AVD's but them coming up disabled or offline. In Linux, I could see the process running, and "ADB Devices" reported that they were there, but offline. I would sometimes need to launch the AVD from the AVD Manager and select "clear user data". It would take a couple of rounds of this before my AVD would launch correctly, but the problem always returned. Something in my code was causing the AVD to get into a bad state and prevent it from launching cleanly.
I have since created a new project and started a new version of my app, and the problem has not returned.
Best I can come up with is to restart the adb server with adb kill-server; adb start-server . Blog post

Developing for Android on Windows 7 using Eclipse

I have followed all the necessary installation and setup steps for Eclipse 3.4 + ADT + Android SDK on Windows 7.
I followed the Hello, Android tutorial in Eclipse and code-completion also works like a charm. No errors shown.
unfortunately the emulator never shows up.
When I run the project. I have fullfilled the same steps in a virtual Windows XP machine and - though very slow - it does work there.
I have not found anything about known problems with Windows 7. What can I do?
Try launching the emulator from the command line with the -verbose option as this may help determine why it is failing:
emulator -verbose -avd <avd name>
To a get a list with the names of AVDs you've set up enter:
android list avd
(If nothing shows up when you list your AVDs that's your problem.)
Ensure you are running the app as an android app and as Dave Webb suggest ensure you have an emulator "profile" created. I created one to meet my HTC Hero and I use Windows 7 (x64).
NOTE: You might also want to unplug your HTC device, if its connected to the PC. I've noticed that if its plugged in the apps will download and run directly on the real device. Thats probably by design and intentional. ;-)
HTH
Philip
I am developing on Windows 7 Pro with no issues. Eclipe and Emulator are all working OK.

Categories

Resources