7

I am trying to run an android emulator on Linux mint.

When I try to run the avd , on the emulator, I get the following error.

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 undefined

When I navigate to android_sdk/system-images/android-21/default/armeabi-v7a

There exists a kernel file called kernel-qemu

I guess there is some sort of compatibility issue between the emulator and my avd?

Is there a way to resolve this?

Below is the script I use to install my android tools, and create the avd...

# use sdkmanager to install all the tools 
SDKGET=~/android_sdk/tools/bin/sdkmanager 
$SDKGET "build-tools;29.0.2" 
$SDKGET "emulator" 
$SDKGET "platform-tools" 
$SDKGET "platforms;android-21" 
$SDKGET "platforms;android-24" 
$SDKGET "system-images;android-21;default;armeabi-v7a" # lollipop 5.0
$SDKGET "system-images;android-24;default;armeabi-v7a" # Nougat 7.0
$SDKGET "system-images;android-26;default;x86" # Orea 8.0

# use avdmanager to create the virtual devices
AVDMAKE=~/android_sdk/tools/bin/avdmanager 
$AVDMAKE create avd -n Nexus4_5.0_api21 -k "system-images;android-21;default;armeabi-v7a" --device "Nexus 4" # 1280X768
$AVDMAKE create avd -n Nexus5_7.0_api24 -k "system-images;android-24;default;armeabi-v7a" --device "Nexus 5" # 1920 x 1080
$AVDMAKE create avd -n Nexus6P_8.0_api26 -k "system-images;android-26;default;x86" --device "Nexus 6P" # 2560 x 1440
Scorb
  • 1,654
  • 13
  • 70
  • 144

3 Answers3

0

My solution to this was just to use the android-24 and android-26 system images. They worked when the android-21 did not.

Scorb
  • 1,654
  • 13
  • 70
  • 144
0

Try using an older version of the Android Build Tools, if possible. Something like "build-tools;28.0.3" or "build-tools;27.0.3"

Someone here -- https://github.com/mingchen/docker-android-build-box/issues/38 -- said that the problem could be caused by the files in the Android-SDK/emulator/ folder not working correctly, when the newer versions of the Build Tools are installed.

I don't know if there's a way to downgrade the files in Android-SDK/emulator/, but you can copy the folder from an old installation and replace it in your new installation. And you should check for a file named emulator64-arm, and check the source.properties to see what build tools version it refers to.

Mr-IDE
  • 7,051
  • 1
  • 53
  • 59
0

The reason is because Android emulator was updated in a recent version to expect the 'kernel-ranchu' file instead of the 'kernel-qemu' file. Therefore, system images for older versions of Android that only include 'kernel-qemu' may not work properly with the new emulator.

Therefore I fix it with these steps:

  1. Visit Android Studio menu "Tools" -> "SDK Manager" -> "Appearance & Behavior" -> "System Settings" -> "Android SDK" -> "SDK Platforms" tab -> Tick bottom right "Show Package Details"
  2. Scroll to "Android 5.0 (Lollipop)" and untick to uninstall existing both "Google APIs Intel x86 Atom System Image" and "Google APIs Intel x86 Atom_64 System Image" (to clear old incomplete which only have kernel-qemu but missing kernel-ranchu). Click "OK" to start uninstall.
  3. Android Studio menu "Tools" -> "Device Manager" -> "Create device" -> "Nexus 5"(got Play Store) -> "x86 Images" tab -> choose "Lollipop 21 x86_64 Android 5.0 (Google APIs)" -> "Next" -> "Finish" (which re-install and both kernel-qemu and kernel-ranchu files appear in the folder of error log above, in my case is Found systemPath D:\Android\Android\Sdk\system-images\android-21\google_apis\x86_64\)
  4. Launch the new created device, the error gone.
林果皞
  • 7,539
  • 3
  • 55
  • 70