Search code examples
androidflutterandroid-studioabi

Flutter - how fix issue in appbudle?


I have Flutter app for android(work with the network). the application works in debug mode. I create appbundle - download the console to Google, then download the universal apk file (for all platforms). But when I install the application from the store (that is, for a certain device - a certain platform), I have a problem with the operation of the application. I managed to reproduce this issue locally on the computer:

  • I create appbundle
  • I will create a set of apks from appbundle(with bundletool)
  • then I install the apk on my phone(with bundletool) - the same problem

it also seems that the problem is related to abi. This is my code from build.gradle:

buildTypes {
        release {
            minifyEnabled false
            zipAlignEnabled false
            shrinkResources false
            signingConfig signingConfigs.release
            ndk.abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
        }
        debug {
            minifyEnabled false
            zipAlignEnabled false
            shrinkResources false
            signingConfig signingConfigs.release
            ndk.abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
        }
    }
    splits {
        abi {
            enable true //enables the ABIs split mechanism
            reset() //reset the list of ABIs to be included to an empty string
            include 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
            universalApk true
        }
    }
..........

project.ext.versionCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, 'x86': 3, 'x86_64': 4]

android.applicationVariants.all { variant ->
    variant.outputs.each { output ->
        output.outputFileName = "myapp_" + variant.versionName + "_" + output.getFilter(com.android.build.OutputFile.ABI) + ".apk"
        output.versionCodeOverride =
                project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) *
                        1000000 + android.defaultConfig.versionCode
    }
}

Configs for debug and release are same almost the same. but when i run in debug the app works.

how can I understand what is the cause of the error? how could I join in debug mode to the release apk - but it's probably not possible.

any advice - I will be very grateful


Solution

  • I fixed this issue - added it line to gradle.properties

      android.bundle.enableUncompressedNativeLibs=false