Android: The compiled APK file cannot be installed
The compiled APK file cannot be installed — it shows a message about device incompatibility. It's not possible to compile and install the APK via USB; the emulator keeps launching instead.
Problem
java version "24.0.2" 2025-07-15 Java(TM) SE Runtime Environment (build 24.0.2+12-54) Java HotSpot(TM) 64-Bit Server VM (build 24.0.2+12-54, mixed mode, sharing)
dx doctor ───────────────────╯ Setup Web: wasm-bindgen, wasm-opt, and TailwindCSS are downloaded automatically iOS: Install iOS SDK and developer tools and through XCode Android: Install Android Studio, NDK, and then set ANDROID_HOME and ANDROID_NDK_HOME macOS: all tools should be installed by default Windows: install the webview2 binary Linux: Install libwebkit2gtk-4.1-dev libgtk-3-dev libasound2-dev libudev-dev libayatana-appindicator3-dev libxdo-dev libglib2.0-dev nix: Make sure all tools are in your path (codesign, ld, etc.)
Rust Rustc version: rustc 1.89.0 (29483883e 2025-08-04)
Rustc sysroot: C:\Users\user.rustup\toolchains\stable-x86_64-pc-windows-msvc Rustc path: C:\Users\user.cargo\bin\rustc.exe Cargo path: C:\Users\user.cargo\bin\cargo.exe cc path: not found
Devtools VSCode Extension: C:\Users\user.vscode\extensions\dioxuslabs.dioxus-0.6.0 Cursor Extension: C:\Users\user.cursor\extensions\dioxuslabs.dioxus-0.6.0 TailwindCSS: C:\Users\user.dx\tailwind/tailwindcss-v4.1.5.exe
Web wasm-opt: not installed wasm-bindgen: C:\Users\user.dx\wasm-bindgen/wasm-bindgen-0.2.100.exe wasm-bindgen version: 0.2.100
iOS/macOS XCode: not found Simulator: not found Security CLI: not found Codesign CII: not found xcode-select: not found xcrun: not found ranlib: C:\Program Files\LLVM\bin\llvm-ranlib.exe
Android sdk: C:\Users\user\AppData\Local\Android\Sdk ndk: C:\Users\user\AppData\Local\Android\Sdk\ndk\25.2.9519653 adb: C:\Users\user\AppData\Local\Android\Sdk\platform-tools\adb.exe emulator: not found java_home: C:\Program Files\Android\Android Studio\jbr
Toolchains ✅ wasm32-unknown-unknown (web) ✅ aarch64-android-linux (android) ✅ i686-linux-android (android) ✅ armv7-linux-androideabi (android) ✅ x86_64-android-linux (android) ❌ x86_64-apple-ios (iOS) ❌ aarch64-apple-ios (iOS) ❌ aarch64-apple-ios-sim (iOS) ❌ aarch64-apple-darwin (iOS)
The compiled APK file cannot be installed — it shows a message about device incompatibility. It's not possible to compile and install the APK via USB; the emulator keeps launching instead.
Screenshots
Environment:
- Dioxus version: last main branch dioxus 0.7.0-rc.0 (5ebde96)
- Rust version: rustup 1.28.2 (e4f3ad6f8 2025-04-28)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active
rustcversion isrustc 1.89.0 (29483883e 2025-08-04) - OS info: Win 11
- App platform: android
Set --target to that of the target device when building.
I ran into this as well, setting --target fixes it with dx build --android --release --target aarch64-linux-android, although the output files are still apk-debug.apk so I might have missed something still.
Maybe something to add to https://github.com/DioxusLabs/docsite/blob/main/docs-src/0.7/src/guides/platforms/mobile.md or https://github.com/DioxusLabs/docsite/blob/main/docs-src/0.7/src/guides/deploy/android.md.
Or maybe good for the release profile to default to arm instead of x86_64
This command works well:
dx build --android --release --target aarch64-linux-android
and the application installs successfully. However, upon launch, the following error occurs:
java.lang.NoSuchMethodError: no non-static method "Landroid/view/WindowManagerImpl;.getCurrentWindowMetrics()Landroid/view/WindowMetrics;"
I think the windowing library used by dioxus - tao - requires android api 30 (i.e. android 11).
Also related #2706.
🚨 Root Cause Identified: Device Too Vintage 📱
Turns out, the crash stems from your app trying to call getCurrentWindowMetrics() — a snazzy method introduced in Android API level 30 (Android 11).
Unfortunately, you’re running it on a device that still remembers the days of “Hey Google, what’s Android 10?” 😅
In other words: Your phone is not broken — it’s just… nostalgically incompatible.
✅ Recommended Fix: Declare Compatibility Explicitly
To prevent this from happening (and to gently tell older devices “it’s not you, it’s me”), you should specify SDK compatibility.
✅ Option 1: Via Dioxus.toml (Recommended)
I’ve already added the appropriate config to your Dioxus.toml:
[android.app]
# Required for getCurrentWindowMetrics() — min Android 11 (API 30)
min_sdk_version = 30
target_sdk_version = 34
compile_sdk_version = 34
💡 This is the preferred Dioxus-native way to enforce Android compatibility.
⚙️ Option 2: Via AndroidManifest.xml (For fine-grained control)
After building your Android project, locate the generated AndroidManifest.xml (typically under target/android/) and ensure it includes:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk
android:minSdkVersion="30"
android:targetSdkVersion="34" />
<application>
<!-- The rest of your glorious app config -->
</application>
</manifest>
🧱 Option 3: Via build.gradle (If manually managing Gradle)
If you’re generating or editing Gradle files directly, ensure your build.gradle contains:
android {
compileSdkVersion 34
defaultConfig {
minSdkVersion 30
targetSdkVersion 34
// ...other majestic settings
}
}
🎯 TL;DR
Set minSdkVersion = 30 somewhere — preferably in Dioxus.toml.
Older devices? They’ll just have to live in the museum (or upgrade 😉).