Removing "x86"
and "x86_64"
from the ndk
configuration in your Flutter app's build.gradle
file will have the following effects:
Reduced APK Size: The APK will no longer include native libraries for x86 and x86_64 architectures, making the APK smaller in size.
No Support for x86 Devices: The app will not run on:
Performance Impact on Emulators: x86 emulators will need to use ARM translation (slower) rather than running native x86 code.
Supported Architectures: The app will only support:
Play Store Impact: Google Play will only serve your app to ARM-based devices, not x86 devices.
This is generally a safe optimization since:
If you need to support x86 devices (rare), you should keep those entries. Otherwise, removing them is a good optimization.
Here's how to address each of these issues in your Flutter app:
Key changes made:
NDK Configuration:
Android 15 Compatibility:
resizeableActivity="true"
for large screen supportNative Library Alignment:
Additional recommendations:
Here's a summary of the files I updated and the specific changes made:
android/app/build.gradle
compileSdkVersion
to 34ndkVersion "25.1.8937393"
targetSdkVersion
to 34Based on your build.gradle
file, here are the issues and required changes to address the recommendations:
build.gradle
:// Required changes in build.gradle:
android {
compileSdkVersion 34 // Keep this (matches targetSdk)
ndkVersion "25.1.8937393" // Explicitly set NDK version
defaultConfig {
minSdkVersion 23
targetSdkVersion 34
multiDexEnabled true
ndk {
abiFilters "arm64-v8a", "armeabi-v7a" // Correct as per your needs
}
}
packagingOptions {
pickFirst '**/libc++_shared.so' // Simplified version
}
}
// Required changes in build.gradle:
android {
compileSdkVersion 34 // Keep this (matches targetSdk)
ndkVersion "25.1.8937393" // Explicitly set NDK version
defaultConfig {
minSdkVersion 23
targetSdkVersion 34
multiDexEnabled true
ndk {
abiFilters "arm64-v8a", "armeabi-v7a" // Correct as per your needs
}
}
packagingOptions {
pickFirst '**/libc++_shared.so' // Simplified version
}
}
android/app/src/main/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fitstand.app">
<application
android:name=".Application"
android:label="FitStand"
android:icon="@mipmap/ic_launcher"
android:resizeableActivity="true"
android:supportsRtl="true">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<meta-data
android:**
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fitstand.app">
<application
android:name=".Application"
android:label="FitStand"
android:icon="@mipmap/ic_launcher"
android:resizeableActivity="true"
android:supportsRtl="true">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<meta-data
android:**
Based on your build.gradle
file, here