I'm trying to run my android emulator on windows console but I get this error:
emulator: ERROR: Your system directory is missing the 'kernel-qemu' image file.
Please specify one with the '-kernel <filepath>' option
how can I fix this?. thanks for tour time.
----- UPDATE -----
I finally can fix this error. At fisrt, I planned to install android SDK offline rather than using SDK Manager. So I followed up this instruction and downloaded the components I need. Everything is correctly except that when I extract the platform using IZArc the file kernel-qemu which located in /platform/images/ is not extracted. But when I manually choose the file from IZArc and drag it to any folder it's extracted. Maybe this is about IZArc configuration but this error cost me for almost a week!
do you have your kernel image file under
< android >/tools/lib/images/
directory?
but i think your problem is your sintaxis to run the emulator
./emulator -kernel kernel-qemu -system
system.img -ramdisk ramdisk.img
-initdata userdata.img -partition-size 512
Related
I compiled my own AOSP image and got this:
lz#vm:/mnt/android-dev-3/aosp/grapheneos-lz_experiments/out/target/product/generic_x86_64$ ls *.img
cache.img ramdisk.img system.img vendor_boot-debug.img
dtb.img ramdisk-qemu.img system-qemu.img vendor_boot.img
encryptionkey.img super_empty.img userdata.img vendor.img
ramdisk-debug.img super.img vbmeta.img vendor-qemu.img
I then compiled my own Android emulator.
I know I dont need to specify the .img myself, the AOSP prebuilt emulator just works, but I want to for other purposes.
So I did DIR_OUT = /mnt/android-dev-3/aosp/grapheneos-lz_experiments/out/target/product/generic_x86_64
./emulator -sysdir $DIR_OUT/system -datadir $DIR_OUT/data -kernel $DIR_OUT/kernel-ranchu -ramdisk $DIR_OUT/ramdisk.img -system $DIR_OUT/system.img -data $DIR_OUT/userdata.img -cache $DIR_OUT/cache.img -vendor $DIR_OUT/vendor.img
emulator: ERROR: No AVD specified. Use '#foo' or '-avd foo' to launch a virtual device named 'foo'
emulator: WARNING: userdata partition is resized from 550 M to 800 M
emulator: WARNING: encryption is off
Segmentation fault (core dumped)
You can see that I ignored the AVD error by commenting the return
if (!avdName && !avdArch && !androidOut && !forceEngineLaunch && !queryVersion) {
derror("No AVD specified. Use '#foo' or '-avd foo' to launch a virtual"
" device named 'foo'\n");
//return 1;
}
because without it I couldn t get anything to work. It could be segfaulting because of my quirk, but without it I dont see how to run with the .img myself.
Here s what the android emulator says about specifying my own .img files:
./emulator -help-disk-images
The emulator needs several key image files to run appropriately.
Their exact location depends on whether you're using the emulator
from the Android SDK, or not (more details below).
The minimal required image files are the following:
kernel-qemu the emulator-specific Linux kernel image
ramdisk.img the ramdisk image used to boot the system
system.img the *initial* system image
vendor.img the *initial* vendor image
userdata.img the *initial* data partition image
It will also use the following writable image files:
userdata-qemu.img the persistent data partition image
system-qemu.img an *optional* persistent system image
vendor-qemu.img an *optional* persistent vendor image
cache.img an *optional* cache partition image
sdcard.img an *optional* SD Card partition image
snapshots.img an *optional* state snapshots image
If you use a virtual device, its content directory should store
all writable images, and read-only ones will be found from the
corresponding platform/add-on directories. See -help-sdk-images
for more details.
If you are building from the Android build system, you should
have ANDROID_PRODUCT_OUT defined in your environment, and the
emulator shall be able to pick-up the right image files automatically.
See -help-build-images for more details.
If you're neither using the SDK or the Android build system, you
can still run the emulator by explicitely providing the paths to
*all* required disk images through a combination of the following
options: -sysdir, -datadir, -kernel, -ramdisk, -system, -data, -cache
-sdcard and -snapstorage.
The actual logic being that the emulator should be able to find all
images from the options you give it.
There s nothing saying how to overcome that error
UPDATE:
Segmentation fault is in this exact line:
https://android.googlesource.com/platform/external/qemu.git/+/refs/heads/aosp-emu-30-release/android-qemu2-glue/main.cpp#476
sysImagePath = std::string(
avdInfo_getSystemImagePath(m_avd)
?: avdInfo_getSystemInitImagePath(m_avd));
UPDATE:
I tried with
./emulator -sysdir $DIR_OUT/system -datadir $DIR_OUT/data -kernel /home/project/disk/aosp/grapheneos-lz_experiments/prebuilts/qemu-kernel/x86_64/5.4/kernel-qemu2 -ramdisk $DIR_OUT/ramdisk-qemu.img -system $DIR_OUT/system.img -data $DIR_OUT/userdata-qemu.img -cache $DIR_OUT/cache.img -vendor $DIR_OUT/vendor.img
(I added -qemu to some .img that had the qemu in the name)
But the problem persists the same
try this.
https://source.android.com/setup/create/avd
To build and run an AVD system image:
Download the Android source:
mkdir aosp-master; cd aosp-master
repo init -u
repo sync -j24
If you want to build other Android versions, you can find their branch names in the public Android repository. They map to Android Codenames, Tags, and Build Numbers.
Build an AVD system image. This is the same process as building an Android device system image. For example, to build a x86 32-bit AVD:
mkdir aosp-master; cd aosp-master
source ./build/envsetup.sh
lunch sdk_phone_x86
make -j32
If you prefer to build an x86 64-bit AVD, run lunch for the 64-bit target:
lunch sdk_phone_x86_64
Run the AVD system image in the Android Emulator:
emulator
See the Command-line startup options for more details about running the emulator. Figure 2 shows an example of the Android Emulator running an AVD.
After adding my device ( Pixel 2 Pie 9.0 API-28) This error log is shown. I manage and configure sdk manger. After that I install Hyper V for emulating third party emulator for visual studio. Everything was ok but when I lunch my device this error is showing. What is the problem and can you show me any solution to solve this?
I tried to reset device manger or delete devices. But that doesn't work.
This is my Error log.
Device error: emulator: Android virtual device file at: C:\Users\DELL\.android\avd\pixel_2_pie_9_0_api_28.ini
emulator: virtual device content at C:\Users\DELL\.android\avd\pixel_2_pie_9_0_api_28.avd
emulator: virtual device config file: C:\Users\DELL\.android\avd\pixel_2_pie_9_0_api_28.avd\config.ini
emulator: using core hw config path: C:\Users\DELL\.android\avd\pixel_2_pie_9_0_api_28.avd\hardware-qemu.ini
emulator: using snapshot lock path: C:\Users\DELL\.android\avd\pixel_2_pie_9_0_api_28.avd\snapshot.lock
emulator: using multi-instance lock path: C:\Users\DELL\.android\avd\pixel_2_pie_9_0_api_28.avd\multiinstance.lock
emulator: Found AVD target API level: 28
emulator: Read property file at C:\Program Files (x86)\Android\android-sdk\system-images\android-28\google_apis_playstore\x86\\build.prop
...
...
...
emulator: Concatenated backend parameters:
'"C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe"' -verbose -feature WindowsHypervisorPlatform -avd pixel_2_pie_9_0_api_28 -prop emu.uuid=5b4f3ed6-3bd5-45c9-a093-06751e03b091
I really want to know how to resolve it.
Thank you.
It is best to uninstall and reinstall API 28 and any corresponding files and SDKs. Either that or beside the apply changes button in the SDK there should be a button for repair. Click that and allow it to run.
I simply replaced the existing Mono.Posix.dll with the latest version of Mono.Posix.dll, to do so copy the .dll to C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\Xamarin.VisualStudio and it started working for me, you can get the latest Mono.Posix.dll from https://www.dllme.com/dll/files/mono_posix_dll.html
The Android Device Manager asked me if i want to reinstall i said yes, clicked accept and that was all (It make take a couple of minutes so be patient)
i'm sitting here at problem now for two weeks and can't quiet figure it out...
For some researches I want to build the mini_emulator_x86-eng on a terminal server and after that copy it to my laptop and run it.
I use a terminalserver for my aosp builds with the newest version "android-8.0.0_r4", because it has much more resources then my laptop (Ubuntu 12.04 with the newest Android Studio).
So I build the files and the copy the .img files + kernel from the out/target/product/mini-emulator-x86/ folder and my avd folder .android/avd/own.avd/.
In the avd folder there is also my config file, which looks like this:
config.ini
avd.ini.encoding=UTF-8
PlayStore.enabled=false
abi.type=x86
hw.cpu.arch=x86
image.sysdir.1=/home/olsk7422/.android/avd/own.avd/
tag.display=Google APIs
tag.id=google_apis
After the Emulator start with
AEmulator -kernel ./kernel -system ./system.img -ramdisk ./ramdisk.img -avd own -show-kernel
It shows this and stops:
link
Does anyone have a solution for this ?
I tried also all the other kernels in the prebuild folder, unfortunately no one works ...
I have been trying to get the source code to compile from some time and finally got it compiled. However I am having issues with the emulator where it shows a pop up screen but is quite blank.
I am using Ubuntu Server Xenial and Android 7.1.1 for Nexus6P (but I dont own a Nexus6P so I need to run this on the emulator)
I have tried specifying all the directories such as (-sysdir,-sysdir, -datadir, -kernel, -ramdisk, -system, -data, -cache, -sdcard) although I know that these are supposed to be auto populated by the envsetup.sh file.
The command I used is this:
emulator -kernel ./prebuilts/qemu-kernel/arm64/kernel-qemu -ramdisk ./out/debug/target/product/angler/ramdisk.img -sysdir ./out/debug/target/product/angler/ -cache ./out/debug/target/product/angler/cache.img -system ./out/debug/target/product/angler/system.img -data ./out/debug/target/product/angler/userdata.img -memory 4096 -partition-size 4096 -sdcard sdcard.img -skindir ./sdk/emulator/skins/ -skin WVGA800
I changed the kernel to others such as for ARM/ARM64 but to no avail. All I see is a blank emulator and after changing it to ARM following error:
http://pastebin.com/A04NmNLn
I am at a loss as to why the emulator wont work. Also where is the "image" file with which we can install the Android on Genymotion-type external emulator.
Any help is appreciated!
In order to build AOSP to be run in emulator, there is no need to download any additional binaries. At the same time, emulator cannot run images build for real devices. Therefore, it is required to only download the sources of Android and execute the following commands within the directory with the downloaded sources:
source build/envsetup.sh
lunch aosp_arm-eng #or aosp_x86_64-eng, etc. for details see documentation
make -j4
After the sources are build in the same terminal run the emulator command and the emulator should appear.
I have aready build a emulator with new kernel from source.
And with the built file and source,the project folder is so huge.So,i want to part them off.
Here,i download the sdk tools.
So,i wonder which files does a emulator need at least?such like,system.img and what?
(What's more,i have also build a new kernel,and i want to run the emulator with this new kernel)
thx,in advance!
attached:
After a long time searching,i put the minimal files in a folder like:
:~/droidls
hardware-qemu.img system.img userdata-qemu.img
ramdisk.img userdata.img zImage
And then,i cd to this folder and put the android-sdk-linx/tools path into host os's PATH variable.
At last,I try to use the following command to start the emulator:
emulator -kernel zImage -ramdisk ramdisk.img -sysdir ~/droid -datadir ~/droid -data userdata-qemu.img -system system.img -initdata userdata.img
But it fails.
And with the built file and source,the project folder is so huge.
Please Describle it How the project folder got huge after built it.
So,i wonder which files does a emulator need at least?such
like,system.img and what?
Yes, its nice question. as Per the Official Documentation,
To use the emulator, you first must create one or more AVD
configurations. In each configuration, you specify an Android platform
to run in the emulator and the set of hardware options and emulator
skin you want to use. Then, when you launch the emulator, you specify
the AVD configuration that you want to load.
Each AVD functions as an independent device, with its own private
storage for user data, SD card, and so on. When you launch the
emulator with an AVD configuration, it automatically loads the user
data and SD card data from the AVD directory. By default, the emulator
stores the user data, SD card data, and cache in the AVD directory.
you can Go through the Here For More Description
What's more,i have also build a new kernel,and i want to run the
emulator with this new kernel
For query regarding Running with your New Kernal and running it with your emulator you can Go through Android Kernal Compile and Test with Android Emulator
Hope it Will Help
For running an application on device or emulator Android Package .apk file is needed. A .apk files contains .dex file(files converted to Dalvik byte code), resources files .arsc, Uncompiled resource and AndroidManifest.xml. For more detail see the developer guide document Building and Running.