OSX: Android Emulator Crashes - android

I've just reinstalled eclipse indigo (32bit) and the latest Android SDK. The Android Emulator crashes immediately after it is launched.
Here are my steps:
Create a new Adroid project. Target is Android 4.0, SDK 14.
Press the Run button in Eclipse.
See the Emulator launch and crash about 2 seconds later
Output of crash window:
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
The Eclipse console complains about the following:
Warning once: This application, or a library it uses, is using NSQuickDrawView,
which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
goldfish_fb_load: framebuffer dimensions mismatch
savevm: unable to load section goldfish_fb
emulator-5554 disconnected!
Cancelling 'com.sparky1.HelloAnrdroidActivity activity launch'!
Any thoughts about how to get emulator to behave?

This has already been reported as a Bug: http://code.google.com/p/android/issues/detail?id=724
There are some workarounds presented in this post, too. But at this point, there seams to be no actual fix.

It looks like this happens when an external monitor is connected. Try disconnecting your external monitor and then start emulator. You can attach it back after the emulator starts.

I've seen this problem too. I've found that running emulator from command line and disabling snapshots help a lot.
I'm running:
$ emulator -no-snapshot-load #avd

If disable snapshot when create device, ok. Do not enable snapshot.
If enable snapshot, it's ok to check "save to snapshot" when launch device.
But check "launch from snapshot" is not ok. If already save snapshot, it will cause emulator-arm crash.
After emulator-arm crash by "launch from snapshot", disable snapshot with AVD manager does not work. But run config > target > additional command line option(-no-snapshot-load) works.

I had all these crashes as well and found this in my crash logs:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.CoreFoundation 0x97585bc1 CFStringGetLength + 17
1 com.apple.CoreFoundation 0x9759df63 CFStringCompareWithOptionsAndLocale + 35
2 com.apple.CoreFoundation 0x9759df2c CFStringCompare + 60
3 com.b-l-a-c-k-o-p.CamCamX5 0x03ff3b44 CoreBundleyes::IsMainMember() const + 48
4 com.b-l-a-c-k-o-p.CamCamX5 0x03ff11cc QVDigBaseClass::ClassFactory(ComponentInstanceRecord*) + 50
5 com.b-l-a-c-k-o-p.CamCamX5 0x03ff317b QVDIG_DATA_Open + 23
After spending only a couple of hours :-( on the net I found a tip to remove
/Library/Quicktime/CamCamX5.component
After that no more crashes :-)

An alternative is to switch to using AndroVM in Virtual Box which is an X86 Android image. The big advantage is that it is lightning fast compared to the ARM one. It boots in 2-3 secs. The downside is that you have to manually do the ADB connection and the capturing of the mouse by virtual box is a pain. Not all applications will run on the x86 as well.
To use it you have to configure the first Ethernet adapter as Host Only, run the androVM configuration utility to get the emulator's IP address, then use adb connect ip-address
Another tip is that if the screen times out you need to hit F1 to wake it up.

Related

Android Studio: Unable to obtain result of ADB version

Whenever I attempt to run my android program, android studio throws this error: Unable to obtain result of ADB version.
As a result, initializing ADB fails, and none of my created Virtual Devices are detected.
What helped me get around this problem was the post by prashant2400
(e.g. Go control panel -> System->advance System settings-> Advanced tab->performance->settings->Advance->Virtual memory change). Android Studio: Unable to obtain result of 'adb version'
I had to meddle with this Virtual Memory paging file size, and ADB works after restarting the PC. However, the same problem happens again a day later when i resume coding... and I keep meddling with this page file size and restarting the workstation. How can I fix this problem permanently?
Emulator I am trying to run:
Nexus 5 API 26 (Playstore enabled / API 26 / Android8 / x86 / 1GB)
Android Studio:
2.3.3
PC Specs:
Intel(R) Core(TM) i5-3470 CPU # 3.20GHz
8GB RAM
64 bit operating system, x64-based processor
Any help will be greatly appreciated. I am thinking of buying more RAM (e.g. 8GB to 16GB) if it may help, but I think it's an issue with the latest build of Android Studio 2.3.3
Managed to resolve this problem on my own.
It turns out that it was a timeout issue whereby, the default 5s to wait to get the ADB version was too short. I simply had to increase the connection timeout settings to wait longer as per below.
[1] Go to: File --> Settings --> Tools (Expand Left Panel) --> Tasks
[2] Set the Connection timeout longer (default was 5secs). I set to 10secs.
Regards

Android emulator start slowly and lost from running devices

I have a problem with my AVD in android Studio. After I click the run button and start a new emulator it is very slow when the android starts, the app doesn't install on it. When it is finally running and I click the run button again, I can't find the running emulator in the choose device window.
I've got a MacBook Pro, so it is running on OSX 10.10
Maybe I couldn't set up correctly the intel acceleration, but I don't think so it causes the problem. Running emulator is not found. Sometimes it works, but most of the time it doesn't/
I don't use android studio (prefer eclipse) but maybe you can use a genymotion http://www.genymotion.com/ It's free for non commercial use. It's much more faster in eclipse than normal eclipse emulator. In my opinion it acts like real phone when eclipse symulator is always slow especially with hight resolution screen.
I 've already installed HAXM but It isn't better. I try to do it again. I followed the steps. I typed the terminal steps,but I had some problem.
After this command:
kextstat | grep intel
(got this message )
147 0 0xffffff7f82b0b000 0x14000 0x14000 com.intel.kext.intelhaxm (1.1.1) <7 5 4 3 1>
After that:
sudo kextload –b com.intel.kext.intelhaxm
(but I've got that)
/Users/mecseidani/–b failed to load - (libkern/kext) not found; check the system/kernel logs for errors or try kextutil(8).
/Users/mecseidani/com.intel.kext.intelhaxm failed to load - (libkern/kext) not found; check the system/kernel logs for errors or try kextutil(8).
Can be it a problem!?

Error: Could not access the Package Manager. Is the system running? - At Android Studio

I installed android studio and tried to run easy projects.
But I caught strange error message:
Waiting for device.
/usr/local/idea/android-studio/sdk/tools/emulator -avd Nexus-4-18-xhdpi -netspeed full -netdelay none
emulator: emulator window was out of view and was recentered
Device connected: emulator-5554
Device is online: emulator-5554
Target device: Nexus-4-18-xhdpi [emulator-5554]
Uploading file
local path: /home/nazar/Documents/coursera-android/Examples/HelloAndroid/out/production/HelloAndroid/HelloAndroid.apk
remote path: /data/local/tmp/course.examples.HelloWorld.HelloWorld
Installing course.examples.HelloWorld.HelloWorld
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/course.examples.HelloWorld.HelloWorld"
Error: Could not access the Package Manager. Is the system running?
I couldn't figure out why this happen?
I installed sdk version and configured emulator. Any suggestions?
Here is emulator confiuration:
Update:
I tried to install Genymotion device and use few virtual devices, but caught:
Waiting for device.
Target device: genymotion-nexus_4___4_4_2___api_19___768x1280-192.168.56.101:5555
Uploading file
local path: /home/nazar/Documents/coursera-android/Examples/HelloAndroid/out/production/HelloAndroid/HelloAndroid.apk
remote path: /data/local/tmp/course.examples.HelloWorld.HelloWorld
Installing course.examples.HelloWorld.HelloWorld
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/course.examples.HelloWorld.HelloWorld"
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
Error: Could not access the Package Manager. Is the system running?
How to solve this error?
First make sure you are running Android Studio version above 0.3.2 because there was some issue reported regarding the same in AS 0.3.2 . If it is not you can update it from Help >Check for update.
If you are already running AS above 0.3.2 :
Seems like issue is with your emulator not with Android Studio. It may happen that you are trying to install application before even the emulator started properly.
Wait till the home screen appears in the emulator before trying to install any application.
Also try to install any apk in Emulator from command line
Steps to install
Go to $Android_SDK_DIR\platform-tools, right click there keeping
shift key pressed and Chose "Open Command Window here".
Run command adb devices to make sure yout emulator is running
properly. It will show all your running emulators.
Now if emulators are showing properly, type the command adb install
YOUR_FULL_APK_PATH , YOUR_FULL_APK_PATH is of any .apk file path in
your system.
Please update if this works fine.
The most common cause of this error is simple: You have to manually unlock your Android Virtual Device by swiping the “lock” icon on the screen. Security measures prevent the emulator from letting you connect the debugger before doing this.
The problem is resolved:
In Android Studio
Start run/debug
if you see the message
Do not closed the AVD, just click on run/debug again, the Application will be running when you unlock the application.
The same problem but different solution, I modified my Virtual Device, I changed Memory option and Internal Storage, and it works fine.
RAM:512 , VM HEap: 192, Internal Storage=200, SD Card Size: 200 for Device Nexus 4 android 4.2.2.
In my case this error was caused by SELinux. I got to set SELinux to permissive.
adb shell su 0 setenforce 0
I had this issue, but I found that simply killing the emulator and restarting it worked. There seems to be some sort of race condition where the emulator has not initialized before Android Studio tries to launch the apk and so you get the package error.
I had this too, and using this config worked for me :
Device: Nexus One
Target: Android 4.2.2 -api level 17
CPU/ABI: ARM (armeabi-v7a)
Keyboard: Hardware keyboard present
Memory Options:
RAM: 512
VM Heap: 192
Iternal Storage: 200
SD Card:
Size:200
This Is Worked for me
1)Close Solution.
2)Close Emulator.
3)Run Emulator and Wait till it launch completely and shows Home Screen.
4)After that only Open Solution And Clean,Rebuild and Try to deploy Application.
The same happened to me right now. I don't know if there is another but for me the following worked:
Opened AVD (Android Virtual Device) Manager
Started virtual device
Hit the Run button again (that one at status bar)
Explanation: The problem happened because of timeout. Once device had started, the Android Studio could comunicate with him. (v 0.5.3)
Remove this emulator (in the AVD)
Install this emulator (in the AVD) :)

Android VM crashes on Launch Mac

I have a problem.
I've been working with Android in Eclipse for the past 4-5 weeks now and never had a problem with the VM (they were slow, yes. But never crashed).
Now, I believe since 4.2 when I started working on a new project for uni (deadline next week) my 4.2 VM suddently starts crashing on launch, because of "Kernel Panic" (resport at the end).
I wanted to ask if there is anything I could do, maybe download a hotfix or anything. Both the API and Eclipse are pretty much up to date or might there be something wrong with my computer?
(Somehow even my old VMs (2.3.3, 3.1 and 4.1) crash on launch 99% of the time)
Any advice would be highly appreciated. Here the beginning of the Crash-Log:
Process: emulator64-arm [1334] Path:
/Users/USER/*/emulator64-arm Identifier: emulator64-arm Version:
??? Code Type: X86-64 (Native) Parent Process: eclipse [1156]
User ID: 501
Date/Time: 2012-12-01 00:25:27.469 +0100 OS Version: Mac OS
X 10.8.2 (12C2034) Report Version: 10
Interval Since Last Report: 130686 sec Crashes Since Last
Report: 96 Per-App Crashes Since Last Report: 32 Anonymous
UUID: ABE51F99-F7A9-2595-016E-C47FFD1F6C50
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes:
KERN_INVALID_ADDRESS at 0x0000000000000000
VM Regions Near 0:
-->
__TEXT 0000000100000000-0000000100247000 [ 2332K] r-x/rwx SM=COW /Users/USER/*
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
Do you have two screens? if yes, did you launch avd/vm on secondary screen last time?
If yes, then check config vm file at:
cd ~/.android/avd/
ls -la => here you see all avds
cd [your_vm.avd]
joe emulator-user.ini => edit this config file and see value
window.x = 2054 - this is stupid value, cause says where to display emulator window. Value is set cause emulator window was displayed at second screen on x position 2054 but as I say it's bug at avd. Simply change it to better value to display window at your main screen so like my case:
window.x = 954
window.y = 199
uuid = 1342941165631
Save config file, start eclipse, start your avd/vm and all must run well.
It looks like this happens when an external monitor is connected. Try disconnecting your external monitor and then start emulator. You can attach it back after the emulator starts.
I had the same problem. Yesterday it worked fine. Today crashes with EXC_BAD_ACCESS. Then I noticed that the audio I was listening to stopped for half a second when launching the AVD. I though that might have something to do with it. I stopped iTunes I was listening to, restarted the AVD and yes success. No crash, it started up nicely.

Issue with 'Hello Android' tutorial

I am brand new to Eclipse and Android, but somewhat familiar with Java. That having been said, I tried to follow the 'Hello Android' tutorial from the developer site using the latest Eclipse (Galieo) and the 2.1 Android SDK, I am on a Macintosh running Snow Leopard (OS X 10.6). I have a default virtual device (though my target is actually for phones like my own HTC Incredible which has the snapdragon processor and of course all the latest accoutrement in smart phones).
Everything seemed to go okay until I went to RUN>RUN and then selected 'Android Application'. My computer spins its wheels for a while and then I see two errors. I have pasted the output from Eclipse below:
[2010-05-04 01:53:46 - HelloAndroid] ------------------------------
[2010-05-04 01:53:46 - HelloAndroid] Android Launch!
[2010-05-04 01:53:46 - HelloAndroid] adb is running normally.
[2010-05-04 01:53:46 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch
[2010-05-04 01:53:46 - HelloAndroid] Automatic Target Mode: launching new emulator with compatible AVD 'myAVD'
[2010-05-04 01:53:46 - HelloAndroid] Launching a new emulator with Virtual Device 'myAVD'
[2010-05-04 01:53:58 - HelloAndroid] New emulator found: emulator-5554
[2010-05-04 01:53:58 - HelloAndroid] Waiting for HOME ('android.process.acore') to be launched...
[2010-05-04 01:53:59 - Emulator] 2010-05-04 01:53:59.501 emulator[10398:903] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
[2010-05-04 01:54:23 - HelloAndroid] emulator-5554 disconnected! Cancelling 'com.example.helloandroid.HelloAndroid activity launch'!
I never do see the text in the emulator and the emulator crashes with a message about it quitting unexpectedly.
The crash report states:
Process: emulator [10472]
Path: /Applications/android-sdk-mac_86/tools/emulator
Identifier: emulator
Version: ??? (???)
Code Type: X86 (Native)
Parent Process: eclipse [10468]
Date/Time: 2010-05-04 02:25:41.153 -0500
OS Version: Mac OS X 10.6.3 (10D573)
Report Version: 6
Interval Since Last Report: 2558914 sec
Crashes Since Last Report: 4
Per-App Crashes Since Last Report: 2
Anonymous UUID: C5F178C1-5290-4CA9-AD6E-E9C4F5582754
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000001fd2f000
Crashed Thread: 3
NOTE: Running the emulator from the command line with:
iainnitro-Mac:tools iainnitro$ ./emulator -avd myAVD
2010-05-04 02:49:23.011 emulator[10556:903] Warning once: This application, or a library it
uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw
and move to Quartz.
Segmentation fault
iainnitro-Mac:tools iainnitro$
yields a segmentation fault(as noted above from the terminal output). So the emulator is dying on its own before anything can be shown.
I have tried restarting the ADB processes.
The actual code is line by line from the tutorial and I have never been able to get to the XML part yet.
I am not sure what is wrong with my environment setup or if it is just an incompatibility with Snow Leopard? I would REALLY appreciate any help in resolving this as I am very interested in developing on this platform.
Thank-you,
Mike N Lawrence, Kansas
No direct experience, but this seems to be a recurrent issue:
This thread suggests:
You haven't let the emulator boot all the way up. Start it then wait until you see a desktop, just like on a real phone.
This one mentions (I suspect point 1. is not a concern for you):
Get more RAM. I was running on 256 MB (which I believe is below minimum requirements), just upgraded today to 1024 MB (long time coming), application now starts fine. Although I still do see some error messages in the emulator, they don't seem to actually do anything.
Install from command line. This is a bit laborius, but you can launch an emulator from the command line (assuming <android sdk path>\tools is added to your PATH variable) just type emulator, then browse to the location of your_app_here.apk, and execute
adb install your_app_here.apk
If you launch the emulator from Eclipse, execute adb kill-service and then adb start-service first (or kill-server / start-server. not sure the exact commands). Then your app will be installed on the emulator.
Also (a bit old but might still be relevant)
Maybe the emulator is running so slow, and the adb server, or another component like "DDMS" is a little "desperate" because seems it's waiting to the emulator to iniatialize the some HOME aplication.
But the emulator is running slow, the console in Eclipse send a message: emulator-5554
disconnected! Cancelling 'com.android.hello.HelloAndroid' launch!; and the emulator continues running normally and boot it's system, but don't run application that I build.
So for that problem I run program, and when the emulator is opened, I go back to eclipse in DDMS Perspective and in the Device tab y press a button "restart adb server" before the console shows me the message of "emulator-5554 disconnected!".
I do it several times until the emulator finally boot the OS.
After booted the OS on the emulator, eclipse don't send that disconnect error, and "sends" the app that I've built, also the console shows messages about this.
Then finally appears on the mobile "Hello, Android".
There has been a discussion on this with two proposed solutions
http://code.google.com/p/android/issues/detail?id=724
Comment 17 by zachrcrowe, Jan 06, 2010
FYI - I had to change a line in the Hello Android example to read
this.setContentView(tv); in order for it to work. As mentioned above, the deprecation
warning shouldn't affect the functionality of the emulator.
Comment 18 by mfrony, Jan 14, 2010
I had the same problem when I ran the Hello Android example. The way I solved it and
could run my first Android code was by changing the Project Build Target from 1.1 to 1.5.
This seems to be a timing issue. For some reason Eclipse attempts to load the application on to the emulator before it is "ready". I'm not sure why this occurs but I did find a work around: just start the emulator from the command line before you run the application.
Start clean by closing Eclipse (maybe the OP didn't exit Eclipse before he tried to run via the command line?)
Start the emulator via Terminal by navigating to the android-sdk-mac_86/tools directory and typing:
./emulator -avd my_avd
Open Eclipse and attempt to run the tutorial again using the same steps as before
A dialog box should open asking whether you would like to start a new AVD or use the one that is already running--choose to use the one that is already running.
what i did was to move the circle that appears when the AVD launches to the unlock position, and there it was 'Hello, Android'!
I had this same problem when I tried to run the emulator using a 4.0 AVD. It used to crash at the bootup screen and show 'Segmentation fault' in the console. I was able to fix it by increasing the SD card size of the AVD to 1GB from 32MB.
For whatever reason, I stopped getting the segmentation fault when I added:
this.setContentView(tv);
the 'this' seemingly solved the issue. The seg fault happens if you try to run the emulator without any .apk file I assume. (I was getting that from the command line as well). I hope the tutorial will be updated.
See Related post
Another related post
This worked on Linux for me:
Run Emulator (Wait for the home screen of the Emulator to load)
Click Window > Open Perspective > DDMS
In Devices Panel, click on drop down menu > Reset adb
Run project

Categories

Resources