Android应用构建与运行报错:SupportedAbis should not be null求助
I’ve run into this exact issue before, and it almost always traces back to misconfigured ABI splits or corrupted build artifacts. Here’s how to resolve it step by step:
1. Audit Your ABI Splits Configuration
The error directly points to issues with how your app handles ABI splits. Open your module-level build.gradle (usually app/build.gradle) and check the splits block:
If you’re using ABI splits: Ensure you’ve explicitly defined the ABIs you want to support. Missing
abiFilterswill trigger this error. Example:splits { abi { enable true reset() // Clear default ABIs include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' // Specify supported ABIs universalApk true // Optional: Generate a universal APK } }If you don’t need ABI splits: Explicitly disable splits (don’t just delete the block—some plugins may enable it implicitly):
splits { abi { enable false } }
Also, check if your staging product flavor is overriding splits settings without providing valid abiFilters.
2. Clean and Rebuild Your Project
Corrupted build cache is a frequent culprit. Run these commands in your project’s root directory:
./gradlew clean ./gradlew assembleStagingDebug
Or use Android Studio’s built-in options: Build > Clean Project followed by Build > Rebuild Project.
3. Update Android Gradle Plugin and SDK Tools
Outdated plugin versions often have bugs related to ABI split handling. Go to File > Project Structure > Project and update the Android Gradle Plugin to the latest stable version (match the Gradle version to the plugin’s requirements). Also, update your SDK tools via Tools > SDK Manager > SDK Tools.
4. Validate SDK Version Compatibility
Ensure your compileSdkVersion, targetSdkVersion, and buildToolsVersion are compatible. For example:
defaultConfig { compileSdk 34 targetSdk 34 buildToolsVersion "34.0.0" // Other configs... }
Mismatched versions can cause unexpected manifest processing errors.
5. Invalidate Caches and Restart
If none of the above work, clear Android Studio’s cached configuration: File > Invalidate Caches... > Invalidate and Restart. This fixes any lingering cached conflicts that might be causing the issue.
内容的提问来源于stack exchange,提问作者AlanT

