Android crash: Fatal Exception: java.lang.RuntimeException java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framewor
Problem
2024 Overview: The root of this issue for most all flutter customers is that your app is running on physical android hardware that flutter does not support. The "fix" is to not ship your app to devices where flutter cannot run. For most users this means using gradle to indicate to Google Play that your app can run on a subset of all android supported hardware architectures. Flutter did not include abi filtering in `flutter create` until https://github.com/flutter/flutter/pull/135529/. Add to app flutter customers may not want to add abi filtering and instead may choose to check the hardware before exposing screens using flutter. Original issue: We have seen this crash a number of times in the wild from crashlytics. [code block] [code block] [code block] [code block] Steps to Reproduce I'm unsure exactly how to reproduce as it seems to happen randomly to some users at startup. The only device reported affected in crashlytics: Model:GCE x86 phone - Android 9 Expected results: Actual results: <details> <summary>Logs</summary> [code block] [code block] [code block] </details>
Error Output
Exception: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.runner.jar", zi
Unverified for your environment
Select your OS to check compatibility.
2 Fixes
Implement ABI Filtering for Flutter App Deployment
The crash occurs due to the app being deployed on unsupported Android hardware architectures, specifically x86 devices, which Flutter does not fully support. This leads to runtime exceptions when the app attempts to load native libraries that are not compatible with the device's architecture.
Awaiting Verification
Be the first to verify this fix
- 1
Update build.gradle for ABI Filtering
Modify the app's build.gradle file to include ABI filtering, ensuring that the app is only deployed to supported architectures. This prevents the app from running on unsupported devices.
groovyandroid { defaultConfig { ndk { abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64' } } } - 2
Check for Unsupported Hardware at Runtime
Implement a check in your Flutter app to determine the device architecture at runtime. If the architecture is unsupported, prevent the app from proceeding to the main screen.
dartimport 'dart:io'; if (Platform.isAndroid) { if (Platform.version.contains('x86')) { // Show error message or redirect to a different screen } } - 3
Test on Supported Devices
Before deploying the updated app, ensure to test it on various supported devices to confirm that the ABI filtering and runtime checks are functioning as expected.
- 4
Update Play Store Configuration
After implementing ABI filtering, update the Google Play Store's device compatibility settings to reflect the supported architectures, ensuring that users with unsupported devices cannot download the app.
Validation
To confirm the fix worked, deploy the updated app to a test group and monitor for crashes related to UnsatisfiedLinkError in Crashlytics. Ensure that the app does not launch on unsupported architectures and that users with supported devices can use the app without issues.
Sign in to verify this fix
1 low-confidence fix
Implement ABI Filtering for Flutter App Deployment
The crash occurs due to the app being deployed on unsupported Android hardware architectures. Flutter does not support all architectures, and without ABI filtering, the app may run on devices that cannot execute native code, leading to UnsatisfiedLinkError.
Awaiting Verification
Be the first to verify this fix
- 1
Add ABI Filtering to build.gradle
Modify the app's build.gradle file to include ABI filtering, ensuring that the app only targets supported architectures.
groovyandroid { defaultConfig { ndk { abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86' } } } - 2
Update Flutter SDK
Ensure that you are using the latest version of Flutter SDK that includes ABI filtering support. Run 'flutter upgrade' to get the latest updates.
bashflutter upgrade - 3
Test on Supported Devices
Before deploying the app, test it on various supported devices to ensure that it runs without crashes. Use emulators or physical devices that match the ABI filters specified.
bashflutter run --release - 4
Monitor Crashlytics for New Issues
After deploying the updated app, monitor Crashlytics for any new crash reports to ensure that the issue has been resolved and no new issues have arisen.
noneCheck Crashlytics dashboard regularly.
Validation
Confirm that the app no longer crashes on unsupported devices by checking Crashlytics for reports. Additionally, verify that the app runs smoothly on supported devices.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep