Android Studio: Unable to obtain result of ADB version - android

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

Related

cordova emulate android stuck in loading forever in CMD

The info I suppose would be useful to you:
cordova its version command tells me I have the following version: 9.0.0 (cordova-lib#9.0.1)
The emulator I use: Pixel 2 API_29
I start my emulator through the AVD manager (android studio)
How I start the emulator: cordova emulate android
So, when I use CMD to start my application, it basically ends up with loading dots.
Sometimes the launch etc. is successful, but sometimes, out of nowhere, it keeps on loading, but the launch is never successful.
The build is: success, the launch and deployment however fails.
The loading looks like this in cmd:
...................................................
but it never starts the application.
To give you an idea of how it looks:
(...) //above this line there is info about the build etc.
BUILD SUCCESSFUL in 8s
42 actionable tasks: 42 up-to-date
Built the following apk(s):
C:\Users\gamek\hexadecimal\platforms\android\app\build\outputs\apk\debug\app-debug.apk
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\gamek\AppData\Local\Android\sdk (DEPRECATED)
..............................................................................
The desired behavior I am looking for:
Not have to live in fear whether the application will start in the emulator or not.
I want the application to start in the emulator when I run the command:
cordova emulate android
You can either:
Check that the emulator memory requirements are not too excessive for your system's resources (lower RAM allocated for example, but not below 1024 MB)
Start the emulator manually immediately after booting
Don't close the emulator anymore, leave it running so you can deploy without issues
More Android emulator tips here, make sure you have installed Intel HAXM if you have an Intel processor, or enabled Windows Hypervisor Platform in Windows Features if you have AMD.

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

Eclipse ADT virtual machine won't start

Please note this is not a duplicate. I have found no thread that solves my issue.
I opened up fresh install of eclipse adt with hello world example and opened Android Virtual Device Manager. Here, I added several devices with different configuration and hit start on each of them but all I got is starting virtual device then .. nothing happens. No log, no alert, nothing.
Things, I have tried:
Wait 10 mins after run, nothing happend.
Changed priority on adb.exe to real time
Killed adb.exe (here, console started showing up Connection attempts: 1..2..3 ... nothing more)
Changed perspective to DDMS. Here, no devices are found. Hitted "reset adb" (here, console shows An existing connection was forcibly closed by the remote host)
In Window->Preferences->Android checked SDK location (no spaces)
Run emulator.exe -avd test2 from command line (emulator-arm.exe stop working)
Installed different API. I had API 17 and I installed API 16 (all sub-things)
Run configuration Lauch as ... (not Launch Def. Activity)
Deleting avd's content in userdata fold and creating new
Run as admin
Check stackoverflow for all possible solutions
Minor restarting, creating new AVD, different settings, ram size and stuff..
notes:
- I have new PC, there are no performance issues possible
- I am using Adt bundle windows x86_64 - 2013 02 19 build 21.1.0-569685
- UAC and all those stuff disabled
- Windows 7 64-bit
- Again, Never made it to lock screen, no log available

OSX: Android Emulator Crashes

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.

Categories

Resources