Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libflutter.so And split_config.arm64_v8a.apk!libflutter.so

Tags:

flutter

I have developed app with Flutter and when i released app on Google Play Store I am getting these crashes but couldn’t find any working solution. Please help me with this. Any help will be appreciated. enter image description here

enter image description here

like image 896
Muhammad Shafique Avatar asked Jan 19 '26 17:01

Muhammad Shafique


2 Answers

I resolved this problem by preventing the creation of x86 builds because Flutter doesn't have support for those builds.

To accomplish this, include the following abiFilters in your android/app/build.gradle:

defaultConfig {
    applicationId "com.example.myapp"
    minSdkVersion 21
    targetSdkVersion flutter.targetSdkVersion
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    multiDexEnabled true
    ndk {
        abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
    }
}

buildTypes {
    release {
        signingConfig signingConfigs.release
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
        }
    }
}
like image 85
Dharam Budh Avatar answered Jan 21 '26 06:01

Dharam Budh


Your problem seems to be with android and obfuscation making libflutter.so unreachable.

Go ahead and create at ./android/app a file named

proguard-rules.pro

(to be clear, it will be placed at /android/app/proguard-rules.pro)

and add the following rules to it

#Flutter Wrapper
-keepattributes AutoValue
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.**  { *; }
-keep class io.flutter.util.**  { *; }
-keep class io.flutter.view.**  { *; }
-keep class io.flutter.**  { *; }
-keep class io.flutter.plugins.**  { *; }
-keep class com.google.firebase.** { *; }

EDIT: Also add this to android/app/build.gradle, at buildTypes > release:

buildTypes {
       release {
           //…
            proguardFiles getDefaultProguardFile(
                    'proguard-android-optimize.txt'),
                    'proguard-rules.pro'
       }
 }

I also used at the same time, the same solution as @Dharam did:

abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'

save it and flutter clean your project and compile it again.

What this does is tell the obfuscation service (proguard or R8) to keep these files out of obfuscation (it is ok since there's no point on securing files that are already open-source) I have inserted the firebase stuff too since you're using firebase packages and it caused some issues for me as well.

like image 41
Fernando Rocha Avatar answered Jan 21 '26 07:01

Fernando Rocha