Cannot launch Android emulator using customized built system images - android

I built an Android source on my server successfully. The commands I used are
source build/envsetup.sh
lunch aosp_x86-eng
make -j32
I can also run the emulator successfully on the server without GUI because the server has no available video device. In order to visually see the emulator, I followed the steps mentioned in here and here to move several built images to my laptop (a MacBook Pro). Basically, I used Android Studio to create a x86 emulator and copied several image files (e.g., system.img, ramdisk.img, userdata.img) into the corresponding avd folder. However, when I try to launch the emulator, it only shows a blank screen without any progress even after 5 mins. I have tried to switch off gpu, switch to software rendering, and switch to cold boot but with no success.
I don't understand the reason because it seems others can succeed after following these steps. Can anyone tell me what mistakes I made?

After several days of search, it turns out the answer is pretty simple. Here is what I did to make it work:
Download Intel x86 Atom System Image (previously I only had Google APIs Intel x86 Atom System Image) in Android Studio.
Create an emulator without Google APIs.
Copy the system.img and ramdisk.img I built on server into <SDK folder>/system-images/android-XX/default/x86/ on my MacBook.
Lunch the emulator and it works pretty well.
I also found if using an emulator with Google APIs, it can only work in software - GLES 2.0 mode. But WebView doesn't work in such mode.
So it seems the reason of a blank screen is because I use an emulator with Google APIs... I don't know why but it works.

Related

Is it possible to run Android Device Emulator (via Android Studio 2) on VMWare?

I have been running Android Studio 1.5.1 doing development on a WMWare copy of Windows 2012 R2 and everything works fine. I've been able to run the device emulator with no problems and start various versions of Android running in AVD.
Android Studio 2.x Change
I recently installed Android Studio 2.0 (see image below for exact version).
Now when I attempt to run the emulator nothing happens.
Well, actually I do see a message in the status bar of Studio when I attempt to start the device, but then that message disappears and nothing happens after that.
There is a warning that I need to turn off Hyper-V (see image below), but I don't believe that is possible since this is a VM.
No Longer Possible?
Is it not possible to run the emulator on the VM any more?
More recent versions of the Android Emulator require hardware virtualization support (Intel HAXM).
Unfortunately, most virtual machines do not provide HAXM instructions to the guest (a VM within a VM), so you will be unable to use the emulator within the virtual machine.
I just installed Android Studio 2.1 on my Windows 2008 R2 VM (running VMWare) and I'm happy to report that it is possible to run ARM based AVD (Android Virtual Devices) on the VM.
Steps To Run Arm-based Virtual Device on VMWare
Go to location where you've installed the Android SDKs (in my case it is at %appdata%\Android2\SDK\
If you are in the right place you should see a directory structure and directories like the ones shown in the first image below.
Start the AVD.exe by double-clicking it.
You will see a window like the one in the image below
Take a close look and notice that this is running an ARM(armeabi-v71) image. When you download images you have to download ARM-based images. (no x86 images will work on VM).
Also, you cannot start these images from AVD that launches from Android Studio 2.x
Make sure you have an environment variable named ANDROID_SDK_HOME set to path which is similar to the one at the top of the AVD manager (in image).
Once you do all of this and start an ARM-based image on a VMWare VM it will warn you that it is faster with HAXM but at least the image will run.
Finally, you can see if you attempt to launch your Virtual Device from the AVD Manager in Android Studio then it will warn you that Hyper-V needs to be turned off. Of course you cannot turn Hyper-V off on a VM.
EDIT -- Running Android 7 ARM Image
#mcflysoft asked about running an android 7 ARM image. At first I didn't think it worked, but if you open up your SDK manager and install the exact ARM OS image shown in the following picture, it will run on a Windows VM:
ARM image Containing Google APIs
I tried installing the ARM image that contained the Google APIs and that one would not ever start. There were failures logged which I could see in c:\> adb shell logcat.
Beware : It Is Really Slow
However, running Android 7 seems extremely slow and I don't see a web browser.
Not sure how helpful it may be to you, but you can get it working.
Good luck.
The simplest solution I've found so far is to use a device farm, for example Samsung's device farm:
https://developer.samsung.com/remotetestlab/galaxy/rtlDeviceList.action#444
It's free to use and you can deploy your apps just like in an emulator (Right Click -> Test -> Remote Debug Bridge -> follow the instructions).
And since those are real devices, the speed might be even better than on an emulator on your personal PC.
I've had the same problem so I'll post an answer in the hope that someone might find this useful in the future. I can run Android Studio in my VM but when I try to start up an emulator, I can't download an image due to "Your CPU does not support required features (VT-x or SVM)"
Although I didn't get a virtual device up and running, I got round the problem by using BlueStacks. You install BlueStacks on the VM. BlueStacks (at the moment) runs Android 7.1.1, SDK 25. Inside BlueStacks, go to Settings/Preferences and Enable Android Debugger Bridge (adb) following this set of instructions. Then you should be able to run your app on BlueStacks from inside Android Studio. Logcat can see any log statements from BlueStacks.
The alternative (without enabling the debugger bridge) is to locate the .apk file for your app and then open that with BlueStacks APK installer. Logcat still sees the traces.
It's slow on a VM. You also have to set android:testOnly="false" in your XML file

How can I run multiple Andy machines

I read that I can run multiple Andy machines in the following link
http://andysupport.s3.amazonaws.com/AndyOSFAQ44v1.pdf
but I cannot open Andy Launcher
I tried to double click HandyAndy's icon in the task bar but it doesn't work
On my windows 8 machine, in the bottom right corner (system tray?) there is an Andy Icon running down by the clock. It might be hidden under an arrow. I right clicked on it and choose "Andy Launcher". You can only run one VM at a time as far as I can figure out. so far.
I can offer:
Emulator as part of the Android SDK
you can download it here: http://developer.android.com/sdk/index.html
To use just open the console /path/to/sdk/tools/android avd
and create your AVD (Android Virtual Device) and run. Or open AVD Manager from Eclipse IDE. But no emulation Bluetooth, OTG, headphones and some other hard parameters. Has a plug-in for Eclipse, easy access via adb
Genymotion
you can download it here: http://www.genymotion.com/
When you create a device from the network pumped his image. APK can be installed by simply dragging them to the window with the virtual machine.
Has a plug-in for Eclipse, easy access via adb and many additional tools (charge control, an accelerometer, API for tests, etc.)
Manymo
Here's an interesting emulator, but slow. No installation required, runs directly in the browser. To use this emulator will require registration.
https://www.manymo.com/emulators
Bluestacks
you can download it here: http://www.bluestacks.com/
It is best to download it from the official site. Works stable than custom build. Easy to install, does not require any additional libraries and files.
Immediately have access to Google Play.
use Genymotion its best way to test your app
or direct run in your phone android device turn on the usb debugging
if you have the memory disk space, You can use Oracle VMware install download a live version of windows, then install andy on each one of your vm machines. I am able to run 10 andy emulators at the same time while using the setting the restrict cpu cores and threads and memory allocations.
I say live os version because in order to run live edition requires 1gb ram, or 2gb for most full desktop OS's

What emulator does Android Studio use?

This question has many parts.
Some info about my system:
64-bit Ubuntu Linux
I am wondering what the stock emulator is that comes with Android Studio (A.Studio) (if indeed it has a name).
A helpful answer would include comparing this emulator with other emulators. A list of pros and cons of using each different emulator would also be helpful.
Perhaps there is a more fundamental ~thing~ about using different emulators; information on that is welcome if anything comes to mind.
Finally, i have never used an emulator besides the one that has come with Eclipse or A.Studio. What do I need to know in order to plug any emulator into any IDE? I have had issues with IDEs being "fragile" and breaking frequently, FYI.
You can use genymotion, for fast speed the quality, both for the eclipse and Android studio, get it here.
Also you can set up the Google play service for using Google Maps and downloading apps from Google play store.
Get the package and how it use it , please refer to here.
The emulator used by Android Studio is the exact same one used with Eclipse. It is in fact included with the Android SDK (which is in turn included in Android Studio) and used by various development environments.
The way it works depends on what kind of system image you use it with. For most recent Android versions, there are 2-4 different system images - arm, arm 64-bit, x86, and x86 64-bit (the 64-bit ones are Lollipop only, and fairly experimental at this stage of the game [early 2015]).
There are also Google API versions of these images (they include various Google apps such as Google Play Services) which can be used if these components are needed by your app.
For development purposes, the x86 system images are your best bet as performance is vastly improved by the emulator not having to emulate the ARM architecture - you need to use HAXM (by intel, also available in the Android SDK) to get any real speed benefits with x86 images though. The emulator also provides GPU acceleration (it must be manually enabled for each emulator device) which allows it to use your physical GPU for rendering instead of emulating these operations in software.
The way the development environment (Android Studio) connects to the emulator is via ADB (Android Debug Bridge). This means that it can work with virtually any emulator (such as Genymotion, which runs via VirtualBox). However, there is native support for using the Android Emulator from within Android Studio (this is configured by selecting emulator in the Run/Debug configuration)...when using another emulator (such as Genymotion) you should select USB device (in Run/Debug configuration) and make sure that the ADB instance is connected to your emulator via TCP (Genymotion does this for you automatically at startup).
This should give you enough information and I will not re-post all the various instructions on how to do any of the above as they have been posted as answers to various questions here on SO.

Installing Facebook.apk on emulator

I get the following message when I try to install Facebook-11.apk on the emulator:
Failure [INSTALL_FAILED_NO_MATCHING_ABIS]
I've found this and it wasn't very helpful. My emulator's Image is Intel Atom (x86_x64) (API 21).
I've searched everywhere and can't seem to find a solution to this. Thanks in advance!
For google searchers out there - Use Genymotion if you want to check your app with the Facebook app.
As mentioned - you can't install Facebook apk on Intel-based images.
I did it on emulators from Android Studio. Basically you can use any ARM emulator but they are slow as hell, so I do not recommend them. In order to use x86:
Go to https://www.apkmirror.com/apk/facebook-2/facebook/variant-%7B%22arches_slug%22%3A%5B%22x86%22%5D%7D/ and download any app you like (but you will have to try some of them, e.g. first one at the moment I was writing this answer did not work on x86 emulator)
Download the selected apk.
Drag'n'drop it on the launched emulator.
Whooorey!

Is there a way I can run android OS and apps from my windows PC?

I am developing an android app and want to test on the latest version of android, also I need to check some apps from google store, so Is there a way to run full android OS from my PC, I searched and found some telling to use virtualbox, but I tried the installation steps and it didn't work, are there any other suggestions?
You can use GenyMotion for that. It provides Android VM that are really better than the one of SDK (chosse images of Android machines that are provided with google apps for retrieving apps from Play Store).
Assuming the normal android sdk is already installed, using the Android SDK manager:
Install the Intel x86 Atom System Image of the latest api level.
Install Intel x86 Emulator Accelerator HAXM which can be found in the folder called "tools" inside the list provided by the Android SDK Manager (for those of you on Linux, you'll have to hunt around and install kvm instead).
Create an AVD using the AVD Manager
Make sure you select the x86 version when creating the AVD, the select box defaults to ARM.
And tick the checkbox Snapshot, to make sure your image keeps anything you install on it between restarts.
Fill out the rest of the parameters, create your AVD, and start it (the first time it runs will take the longest, the second time will be faster). That being said, it's still a good idea not to shutdown the emulator between tests because of the reboot time.
AVDs based on parameters alone and not actual device names will also be faster than the ones that have specific model names, but bear in mind that those with parameters will include less stuff. So it sounds like you'll want to make sure you select one with a specific phone model name.
Genymotion should work just fine as well. Just note that for the non-AOSP phones, you may have to install some of the system apks separately (because of licensing reasons, but those system apks should be very easy to find if you just google around for them)

Categories

Resources