tweaselORG / appstraction

An abstraction layer for common instrumentation functions (e.g. installing and starting apps, setting preferences, etc.) on Android and iOS.
MIT License
6 stars 1 forks source link

Do Android 13 emulators not have ARM emulation anymore? #54

Open baltpeter opened 1 year ago

baltpeter commented 1 year ago

I just noticed that I couldn't install an app with native ARM libraries into my Android 13 emulator created as per our README:

Error: Command failed with exit code 1: adb install-multiple /home/benni/Downloads/single-apks/de.tk.tkapp_168_apps.evozi.com.apk
adb: failed to finalize session
Failure [INSTALL_FAILED_NO_MATCHING_ABIS: INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]
    at makeError (file:///home/benni/coding/JS/tweasel/appstraction/node_modules/execa/lib/error.js:59:11)
    at handlePromise (file:///home/benni/coding/JS/tweasel/appstraction/node_modules/execa/index.js:119:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Object.installApp (/home/benni/coding/JS/tweasel/appstraction/dist/src/android.ts:342:9)
    at <anonymous> (/home/benni/coding/JS/tweasel/cyanoacrylate/examples/multiple-apps.ts:39:9) {
  shortMessage: 'Command failed with exit code 1: adb install-multiple /home/benni/Downloads/single-apks/de.tk.tkapp_168_apps.evozi.com.apk',
  command: 'adb install-multiple /home/benni/Downloads/single-apks/de.tk.tkapp_168_apps.evozi.com.apk',
  escapedCommand: 'adb install-multiple "/home/benni/Downloads/single-apks/de.tk.tkapp_168_apps.evozi.com.apk"',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: 'adb: failed to finalize session\n' +
    'Failure [INSTALL_FAILED_NO_MATCHING_ABIS: INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

The app has native ARM libraries:

❯ aapt dump badging /home/benni/Downloads/single-apks/de.tk.tkapp_168_apps.evozi.com.apk | grep native-code
native-code: 'arm64-v8a' 'armeabi-v7a'

And indeed:

❯ adb shell getprop | grep ro.product.cpu.abi
[ro.product.cpu.abi]: [x86_64]
[ro.product.cpu.abilist]: [x86_64]
[ro.product.cpu.abilist32]: []
[ro.product.cpu.abilist64]: [x86_64]

Whereas in an Android 11 emulator, I get:

❯ adb shell getprop | grep ro.product.cpu.abi
[ro.product.cpu.abi]: [x86_64]
[ro.product.cpu.abilist]: [x86_64,x86,arm64-v8a,armeabi-v7a,armeabi]
[ro.product.cpu.abilist32]: [x86,armeabi-v7a,armeabi]
[ro.product.cpu.abilist64]: [x86_64,arm64-v8a]

To make sure this isn't a problem with how we're creating the emulator, I created a new one using Android Studio. Same problem.

baltpeter commented 1 year ago

To test this further, I also created an Android 12 x64_86 emulator using Android Studio. This one at least supports x86_64 but none of the 32-bit architectures:

❯ adb shell getprop | grep ro.product.cpu.abi
[ro.product.cpu.abi]: [x86_64]
[ro.product.cpu.abilist]: [x86_64,arm64-v8a]
[ro.product.cpu.abilist32]: []
[ro.product.cpu.abilist64]: [x86_64,arm64-v8a]

How odd.

Just to make sure, I also created a fresh Android 11 x86_64 emulator. That does indeed support all relevant architectures:

❯ adb shell getprop | grep ro.product.cpu.abi
[ro.product.cpu.abi]: [x86_64]
[ro.product.cpu.abilist]: [x86_64,x86,arm64-v8a,armeabi-v7a,armeabi]
[ro.product.cpu.abilist32]: [x86,armeabi-v7a,armeabi]
[ro.product.cpu.abilist64]: [x86_64,arm64-v8a]

Here are the supported architectures for an Android 11 x86 emulator:

❯ adb shell getprop | grep ro.product.cpu.abi
[ro.product.cpu.abi]: [x86]
[ro.product.cpu.abilist]: [x86,armeabi-v7a,armeabi]
[ro.product.cpu.abilist32]: [x86,armeabi-v7a,armeabi]
[ro.product.cpu.abilist64]: []

That makes sense at least.

baltpeter commented 1 year ago

Meanwhile, I can't run an Android 13 arm64-v8a emulator on my machine:

INFO    | Android emulator version 31.3.10.0 (build_id 8807927) (CL:N/A)
emulator: INFO: Found systemPath /home/benni/android/system-images/android-33/google_apis_playstore/arm64-v8a/
PANIC: Avd's CPU Architecture 'arm64' is not supported by the QEMU2 emulator on x86_64 host.
baltpeter commented 1 year ago

I tried to look for any announcements or similar regarding this but came up empty. The only thing I found was a StackOverflow question with no answers where the user seems to have noticed the same thing.

In terms of official documentation, I only found:

baltpeter commented 1 year ago

Can someone else please verify my findings? If this is true, we should mention in the README that an Android 11 emulator is recommended for best app compatibility.

zner0L commented 4 days ago

I can confirm this. This is extremely unfortunate.