20

I have a common APK app that utilizes 'arm64-v8a' 'armeabi-v7a' ABIs. How should I tune an Android Virtual Device to be able to launch this app?

I tried different combinations but it still does not work.

A bit of details

Environment

  • Windows 10, CPU Intel Core i5-10300H, RAM 16GB, a lot of free space on a SSD;
  • Android Studio Arctic Fox | 2020.3.1 Patch 3;
  • Intel x86 Emulator Accelerator (HAXM installer) v.7.6.5 is installed;
  • Android SDKs 12.0, 11.0 and 10.0 are installed;
  • Numerous different virtual devices are installed (see the pictures below).

Images that were applied

  • Apply different system images mainly with API from 26 to 31;
  • Images were used from different tabs in the AVD manager (Recommended, x86 and Other Images);
  • Images with ABI both x86, and x86_64, and arm64-v8a;
  • Images with/without Google API, with/without Playstore support.

Errors that I've got

  • Some emulators do not launch. The console says: PANIC: Avd's CPU Architecture 'arm64' is not supported by the QEMU2 emulator on x86_64 host.
  • The APK was not installed on some emulators, a popup with message appears: INSTALL_FAILED_NO_MATCHING_ABI
  • The app tries to start (a splashscreen is shown) but suddenly closes. I've noticed that logcat outputs such message (perhaps related to the app): Unexpected CPU variant for X86 using defaults: x86_64

Some pictures in addition enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Volodymyr Nabok
  • 415
  • 1
  • 4
  • 11
  • Can you get x86 binaries for your libraries to include along with the arm ones? You really do not want to be doing processor emulation if you can possibly avoid it- its a factor of 10 slower minimum. – Gabe Sechan Dec 06 '21 at 20:30
  • 1
    Hey Gabe, thanks for the reply. I'm not sure I understand you right. First, I do not have any additional binaries or libraries (just the APK), thus, I do not have any to include somewhere. Second, I'm really wondered, why the modern APK (arm64-v8a) couldn't be simply launched on the modern images (Android 31 API) without any workarounds. – Volodymyr Nabok Dec 06 '21 at 20:52
  • YOu have binaries- they're in the APK. If you were just using Kotlin or Java without binaries, you'd automatically support every ABI- they're interpreted languages running on a virtual machine. ABIs are only for native (C or C++) libraries. Arm64-v8a is for ARM processors not x86 ones, so they can't be run natively on a PC (unless you have an ARM PC, which is a rarity still). – Gabe Sechan Dec 06 '21 at 21:15
  • Okay Gabe, I see the `./lib` directory contains two folders: `arm64-v8a` and `armeabi-v7a`. Each of this directory has the same list of files: `libapp.so`, `libflutter.so`, `libsqlcipher.so` and `libtool-checker.so`. Then, which libraries should I get and where should I put them? :) – Volodymyr Nabok Dec 07 '21 at 07:29
  • There should be another folder under lib with x86_64 and it needs all of them- any so file you use on the other ABIs you need an x86_64 version. If your build is compiling them, just adding that to the list of ABIs will make it compile that one too – Gabe Sechan Dec 07 '21 at 08:01
  • This is the line that fails: https://android.googlesource.com/platform/external/qemu/+/1381d44efe69ba0b37fb7f7ef868125e279fc14a/android/emulator/main-emulator.cpp#910 – WGH Jan 25 '22 at 18:21

3 Answers3

25

I hit this exact same issue. The comment from @WGH is spot on! Look at the line of code that is failing.

#ifdef __x86_64__
      if (sarch == "arm64" && apiLevel >=28) {
          APANIC("Avd's CPU Architecture '%s' is not supported by the QEMU2 emulator on x86_64 host.\n", avdarch);
      }
#endif

(Source : here)

I deleted my arm64 AVD based on apiLevel 32 and used an older apiLevel of 25 from Nougat 7.1.1 and it loaded up the arm64 AVD just fine on QEMU, ubuntu 20.04. (albeit slowly!!)

The comment from @mtotschnig is also probably relevant however the app I was testing wouldn't run on the api version 30 with the x86_64 AVD that I was attempting to use.

BobMorane
  • 3,870
  • 3
  • 20
  • 42
Peter
  • 443
  • 4
  • 9
2

Now android 11 and above can emulate arm applications: https://developer.android.com/studio/releases/emulator#support_for_arm_binaries_on_android_9_and_11_system_images

Hamzaxxe
  • 21
  • 1
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 20 '23 at 20:10
-8

Ok, the issue is solved. I do not know the root of the cause, but I just:

  • drop all virtual devices,
  • drop whole Android studio,
  • download the studios's installation package again,
  • install Android studio once more,
  • add a known virtual device: Nexus 5X with Play Store, image ABI x86 API 30 with Google Play support.

That's it. The app's been launched.

Volodymyr Nabok
  • 415
  • 1
  • 4
  • 11
  • 7
    Of course it worked, you used a x86 image. – mireazma Jan 24 '22 at 10:39
  • 4
    The reason it works, is that API 30 x86 emulators have arm emulation built in: https://android-developers.googleblog.com/2020/03/run-arm-apps-on-android-emulator.html – mtotschnig Feb 09 '22 at 16:00