Android: Emulator -ramdisk command line option is broken - android

While trying to follow the Tweaking the Android Emulator to include the Scala libraries natively on the emulator, I can't get the custom ramdisk image to load. It appears that the emulator -ramdisk command line option is ignored.

Thanks to Colin on the scala-on-android Google group, he confirmed that there is a defect in the emulator's -ramdisk option.
His workaround, which I verified successfully is to copy the ramdisk.img to the directory of the AVD that you wish to use. On Windows, the AVD files are stored at c:/Users/[UserName]/.android/avd. On Linux, they are stored at ~/.android/avd.
After the ramdisk.img is copied, just start the emulator as usual (no -ramdisk option is necessary).

Related

Cannot run non-x86 arch in Android Studio emulator

First of all, my bug is similar with this one: Where to get this missing file - Android Studio , Emulator
While for all, I installed the latest sdk info in android studio:
The thing is I can only run x86/x86_64 image AVD in my computer. These images works well. But when I try to use other, take arm for example, things don't work out, the AVD just hang there and command output
上午11:33 Emulator: statvfs('/home/f0rm2l1n/.android/avd/Pixel_aarch.avd/snapshots/default_boot/ram.img') failed: No such file or directory
上午11:33 Emulator: Warning: QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled ((null):0, (null))
上午11:33 Emulator: queryCoreProfileSupport: swap interval not found
I tried with choosing Cold Boot and Raising RAM & Storage. But it is not solved.
Any suggestions will help? I just want to run a AArch64 AVD for homework XD

Creating an AVD and linking it to the AOSP

I am trying to use this tool GemDroid https://github.com/huz123/GemDroid_QEMU. I have downloaded the AOSP android-4.4.4_r2 and built it as well. According to the link above, an AVD has to be created using Android Studio, which I did but it give selective options to download a system image, say an Android 4.4.
My first question is how can I link the AVD to the AOSP I have
downloaded? I tried pointing the location of the SDK to the AOSP
location from Files>ProjectStructure in Android Studio but it says
"SDK does not contain any platforms".
Is there a different way whereI can create an AVD directly from the
directory of AOSP?
Or according to the step "start the emulator with
your android virtual device as usual" in the link above, how can I
start the emulator from AOSP with an AVD created using Android
Studio?
I am using Ubuntu 14.04. Please help, thanks!
You don't need the Android Studio for that - just go to your root directory and type in the command line:
emulator
If this doesn't work you probably had a problem in your build.(Build the AOSP)
This is how I run the build
source ./build/envsetup.sh
lunch aosp_shamu-userdebug
./prebuilts/android-emulator/linux-x86_64/emulator
-sysdir out/target/product/shamu/
-system out/target/product/shamu/system.img
-ramdisk out/target/product/shamu/ramdisk.img
-data out/target/product/shamu/userdata.img
-kernel prebuilts/qemu-kernel/arm64/kernel-qemu
-scale 0.7
-memory 2048
-partition-size 4096
-no-window
-verbose

How to add sd card to android emulator in android studio 1.5.1?

I am using android studio 1.5.1 and ubuntu 14.04. I want to add sd card to mobile device emulator.
I created new virtual device using Android Virtual Device Manager from android studio menus Tools --> Android --> AVD Manager. But there is no option to add sd card to virtual device. So tried command line tool mksdcard to create sd card as per instructions given in developer.android.com.
./mksdcard -l mySdCard 128M mySdCardFile.img
And then used following command to start emulator and load sd card.
./emulator -avd Nexus_5_API_23_x86 -sdcard mySdCardFile.img
But it gave me warning emulator: WARNING: Emulated hardware doesn't support SD Cards. -sdcard option ignored.
How can I use sd card in emulator? Please help!
Go to your avd location (typically at ~/.android/avd/your-android-avd-id)
There is a file named config.ini
Open that and look for the line hw.sdCard=no and change it to hw.sdCard=yes.
Should work now.
If you open the settings for this avd in the avd manager, you will have to set this setting in config.ini again.
In your Android emulator's avd files folder (normally it is named as same as the name of the emulator plus ".avd" at the end, and it should be "Nexus_5_API_23_x86.avd" in your case) inside "~/.android/avd" directory.
Find the file named "hardware-qemu.ini", and make sure there is a line set to "hw.sdCard = true".

Android 5.0 emulator showing Storage space running out

I just updated Android SDK to version 21 and trying to start emulator. I am using Nexus 4 with CPU Intel atom (x86) 768 RAM and 524 internal storage. Emulator starts fine but it shows en error message, "Storage space running out" and it is very slow. I tried increasing the RAM also but didn't work. What could be the issue?
Open AVD Manager --> Wipe Data
You have to go in your android folder e.g. on OSX ~/.android/avd/{YOUR_AVD_NAME} and edit file config.ini.
Just add or modify row disk.dataPartition.size = YOUR_SIZE
e.g. disk.dataPartition.size = 1G
Then you may have to wipe your emulator's disk.
emulator -avd "Name" -partition-size 500
This solved the issue for me.
Update on how to execute above command:
Go to a terminal
cd [android SDK directory]/tools/
linux terminal: ./emulator -avd nameOfAvd -partition-size 500 &
windows : emulator -avd nameOfAvd -partition-size 500
Go to AVD manager on your android studio.
click on the pencil icon of the virtual device.
on the pop up window click on advanced settings at the bottom.
scroll down to memory and storage and alter the default definitions of MB/GB etc.
REinstal the emulator..
Go to your AVD location and delete all the files in avd folder( C:\Users\acer.android\avd ),
then Go to android studio AVD Manager and install a new emulator.
( but this will erase the current emulator so, you'll need to download it again..)

Running android emulator using nexus 5 factory image

I've been trying to run the android emulator using nexus 5 factory image.
I've download the factory image and extracted from it the following files:
system.img
boot.img
recovery.img
userdata.img
cache.img
After that, I've extracted from boot.img the ramdisk.img and zImage files.
I tried to run the emulator with the following command:
#!/bin/bash
/home/xx/a/android/sources/out/host/linux-x86/bin/emulator -sysdir /home/xx/a/yy/ -system /home/xx/a/yy/system.img -ramdisk /home/xx/a/yy/boot/initrd.img -data /home/xx/a/yy/userdata.img -kernel /home/xx/a/yy/boot/zImage -sdcard /home/xx/a/android/out/sources/sdcard -memory 512 -partition-size 1024
The emulator will start running without the error, but it will neither show the boot screen nor load the launcher.
It doesn't show any error and i can't get a logcat, meaning, i guess that android hasn't been loaded and it failed earlier.
Now, my question is - What might the reason for it not to work?

Categories

Resources