Android/AOSP: Fun & Qs about the "missing ranchu kernel" - android

After I built Android from AOSP source the official guide suggests that launching emulator is all one needs to do. Sadly that does not work for me...
(I am building for Nexus 7 "deb", Android Studio is not involved, not even present on this very machine.)
emulator: ERROR: bad workspace: cannot find prebuilt ranchu kernel in: ~/aosp/prebuilts/qemu-kernel/arm/ranchu/kernel-qemu
emulator: ERROR: This AVD's configuration is missing a kernel file! Please ensure the file "kernel-ranchu" is in the same location as your system image.
emulator: ERROR: ANDROID_SDK_ROOT is defined (~/aosp/sdk) but cannot find kernel file in ~/aosp/sdk/system-images/ sub directories
Is my ANDROID_SDK_ROOT set properly? One would guess it should be ~/aosp/sdk, but apparently the emulator expects system-images right under ${ANDROID_SDK_ROOT}/. My system-images resides in ~/aosp/prebuilts/devtools though.
When I change it to ~/aosp/prebuilts/devtools it still isn't good enough:
...
emulator: ERROR: ANDROID_SDK_ROOT is defined (~/aosp/prebuilts/devtools) but cannot find kernel file in ~/aosp/prebuilts/devtools/system-images/ sub directories
But there are actually several kernel-ranchu files in those subdirectories:
~/aosp/prebuilts/devtools/system-images/android-23/android-tv/x86/kernel-ranchu
~/aosp/prebuilts/devtools/system-images/android-23/default/x86/kernel-ranchu
~/aosp/prebuilts/devtools/system-images/android-23/default/x86_64/kernel-ranchu
~/aosp/prebuilts/devtools/system-images/android-23/google_apis/armeabi-v7a/kernel-ranchu
~/aosp/prebuilts/devtools/system-images/android-23/google_apis/x86/kernel-ranchu
~/aosp/prebuilts/devtools/system-images/android-23/google_apis/x86_64/kernel-ranchu
~/aosp/prebuilts/devtools/system-images/android-25/android-tv/x86/kernel-ranchu
~/aosp/prebuilts/devtools/system-images/android-25/android-wear/armeabi-v7a/kernel-ranchu
~/aosp/prebuilts/devtools/system-images/android-25/android-wear/x86/kernel-ranchu
~/aosp/prebuilts/devtools/system-images/android-25/google_apis/x86/kernel-ranchu
~/aosp/prebuilts/devtools/system-images/android-25/google_apis/x86_64/kernel-ranchu
Which one is the correct one and how do I deliver it to the emulator?
I tried several -kernel <kernel> but either I got a fatal memory error (for the x86_64-based ones) or I get an emulator with black screen and a popup saying that emulator based based on x86 would be much faster (with the google_apis/armeabi-v7a.) I waited tens of minutes for the last one, nothing happens, still the black screen, not even "android" logo. Maybe because in the middle of the output there is following message:
ERROR: resizing partition e2fsck failed with exit code 8
...strangely the process is not terminated, not sure how fatal the error is then.

Select your CPU/ABI to Google APIs Intel Atom (x86_64) when create the simulator AVD

The issue was that only small subset of targets is intended to run in the emulator. Those with specific device in their name ("deb") are not blessed.
After days of struggling with aosp_deb-userdebug and -eng I tried full-eng and that one works as charm.

Related

android AVD arm wont start

I want to use AVD with arm system image to do some testing
problem is none of the images I select arm64-v8a , armeabi-v7a
whether I select android 7 or 5 the AVD won't start up
error log
10:39 AM Emulator: emulator: ERROR: This AVD's configuration is missing a kernel file! Please ensure the file "kernel-ranchu" is in the same location as your system image.
10:39 AM Emulator: emulator: ERROR: ANDROID_SDK_ROOT is undefined
10:39 AM Emulator: Process finished with exit code 1
tried all the images all gives same issue .
please help :)
Ensure your SDK tools are up to date.
ranchu is the name of type of emulator
goldfish is the older alternative
If just updating doesn't work, then you need to ensure that the emulator version (aka ranchu/qemu) matches the Android version that supports it.
Android 5 (Lollipp[) should support Goldfish & Ranchu though, thats why I think an update is needed.
References:
kernel-ranchu in Android 29
https://forum.gitlab.com/t/this-avds-configuration-is-missing-a-kernel-file/9723/3

Device Error when lunching a emulator in xamarin visual studio. How can I solve it?

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)

Failed to boot android virtual device (AVD) when data is stored on USB memory stick

After successfully setting up a new virtual device with Android Virtual Device manager, booting fails and reports the following error:
10:28 Emulator: emulator: ERROR: A snapshot operation for 'Nexus_5X_API_28' is pending and timeout has expired. Exiting...
10:28 Emulator: Process finished with exit code 1
This sounds similar to a previous question by Anjan Biswas, yet with a possibly different context:
- OS: OpenSuse Leap 42.3
- Android Studio 3.2.1: installed and run from exfatfs memory stick
- .android/avd/{my device} directory holds no "*.lock" file
- The user running Android Virtual Device manager is also the actual owner of .android/avd directory tree.
The message happens exclusively when emulator data is actually saved on the memory stick (either through a symbolic link or by setting ANDROID_SDK_HOME environnement variable).
Explicitely:
- When emulator data is saved on HDD in "/home/{user}/.android" everything works just fine.
- When emulator data is saved on memory stick in "{exfatfs mount point}/.android" error occurs.
- Tried with fat32 file system with same issue.
Looking for a fix to avoid saturate /home with large android virtual device cache.
Many thanks
I also encountered the same problem, it seems to be the problem of exfat format.
I tried to mount an apfs disk and the problem disappeared.

Android AVD for Jelly Bean and Google APIs --

I tried to get an Android AVD working for Jelly Bean (API-16) and Google APIs (I included both in the platform definition). When running the AVD I would get the following error.
$ emulator -avd Nexus_7_API_16_With_Google_APIs
emulator: ERROR: This
AVD's configuration is missing a kernel file!! emulator: ERROR:
ANDROID_SDK_ROOT is defined (C:\data\applications\Android\Sdk) but
cannot find kernel file in
C:\data\applications\Android\Sdk\system-images\ sub directories
I've read through all the similar instances I could find on Stackoverflow and other sites, but none seemed pertinent to my situation.
Unlike most configuration files, the ones used for Jelly Bean and Google API appear to be located in
add-ons rather than in system-image. E.g.:
$ cd $ANDROID_SDK_HOME/.android/avd/Nexus_7_API_16_With_Google_APIs.avd/config.ini
$ grep image config.ini
image.sysdir.1=add-ons\addon-google_apis-google-16\images\armeabi-v7a
In fact, "system-image" appears to be hardcoded into the emulator (although it is possible there is a path around that -- see Cannot run emulator in Android Studio).
This looks very much like a bug to me.
Advice???
Thanks,
Barry

Nexus 5 AVD and Lollipop AOSP

I am able to compile AOSP + binaries and flash my Nexus 5 device. I then realized that it would probably be more practical to make my changes and run these builds on the emulator first to sanity check what I'm doing (I use my Nexus 5 as my main phone).
I've tried running the emulator by typing "emulator" after the build. I get the following error:
ko:Invalid cache partition image type: yaffs2 (expected ext4)
I created a Nexus 5 AVD in Android studio and confirmed that ANDROID_PRODUCT_OUT is pointing to /out/target/product/hammerhead, then I tried the following from the /out/target/product/hammerhead directory:
emulator -avd Nexus_5_API_21 -kernel ~/android-5.0.1_r1/prebuilts/qemu-kernel/x86/kernel-qemu -system ./system.img -ramdisk ./ramdisk.img -data ./userdata-qemu.img
The emulator appears to start up, but I see nothing.
Another piece of information that might help is that when I run the command "android list" I see the following:
Available Android targets:
Available Android Virtual Devices:
The following Android Virtual Devices could not be loaded:
Name: Nexus_5_API_21
Path: ~/.android/avd/Nexus_5_API_21.avd
Error: Unknown target 'android-21' in /home/julio/.android/avd/Nexus_5_API_21.ini
It doesn't seem to like the target android-21, and there doesn't seem to be any targets defined at all.
Anyway, does anyone know how to get this working? I want to avoid having to constantly flash my phone.
Thanks
Building for emulator and real devices are different things. In order to build AOSP for an emulator, you do not need to download any additional binaries. You should only select appropriate targets in lunch command. You can choose among the following targets:
aosp_arm
aosp_x86
aosp_x86_64
etc.
These targets build images to run on different processors architectures (arm, x86, x86-64, etc.).
You can also select different variants (user, userdebug, eng). The details of these variants of builds are explained here.

Categories

Resources