BLOG
BlogGuides

Build an Android APK that runs on cloud test devices

Why an APK needs both arm64-v8a and x86_64 native code to run on Android emulators, and the exact build command for React Native, Expo, Flutter and Gradle.

The build that installs and then crashes#

A common first experience with any cloud mobile testing: you upload the APK from your release pipeline, the run starts, and the app crashes as it opens. Nothing is wrong with your app. The build does not contain native code for the machine it is running on.

Two kinds of Android device#

From Testsy's app docs: our Android devices are emulators, and there are two kinds. A run can land on either.

  • arm64 emulators, which run only arm64-v8a code.
  • x86_64 emulators, which run x86_64 code directly and arm64-v8a code through translation. Translated code is slower, and some apps crash when they open: a React Native or Expo app without x86_64 code does.

32-bit code (armeabi-v7a, x86) runs on neither. So the build to upload is one APK that includes both arm64-v8a and x86_64. Do not strip the other architectures, and do not upload a per-architecture split. An app with no native code (plain Kotlin or Java) needs nothing.

The command for your stack#

Your appCommandThe APK
React Nativecd android && ./gradlew assembleRelease -PreactNativeArchitectures=arm64-v8a,x86_64android/app/build/outputs/apk/release/app-release.apk
Expo (EAS)eas build -p android --profile preview, with "android": { "buildType": "apk" } in that profilethe build's artifact link
Expo (local)npx expo prebuild -p android, then the React Native commandas React Native
Flutterflutter build apk --target-platform android-arm64,android-x64build/app/outputs/flutter-apk/app-release.apk
Native (Gradle)./gradlew assembleDebug, with ndk { abiFilters += listOf("arm64-v8a", "x86_64") } if you filter architecturesapp/build/outputs/apk/debug/app-debug.apk

Release, not debug, for React Native and Expo#

A React Native or Expo release build has its JavaScript inside the APK, so it runs on its own. A debug build expects a Metro server on your computer, which a cloud device cannot reach. Upload the release build, signed with any key, the debug key included.

App Bundles#

An .aab cannot be installed directly. Upload an APK, or a universal APK made from the bundle with bundletool.

What happens when you upload#

Each build is checked when it arrives: package name, version, build number, and whether our devices can run it.

The APK's native codeResult
arm64-v8a and x86_64, or noneaccepted
arm64-v8a without x86_64React Native and Expo: refused. Others: accepted with a warning
no arm64-v8a (x86_64 only, 32-bit only)refused

A refused build comes with the reason and the command for your stack, so the fix is usually one flag. Builds can be up to 1 GB; the newest 20 builds of each app are kept.

This post is part of Mobile release testing: a guide for app teams.

Filed underAndroidApp builds and reviewCI, schedules and agents