4

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

FetFrumos
  • 5,388
  • 8
  • 60
  • 98
  • Can you connect your device to the computer and check for the error log in the logcat window of Android Studio? – gioravered Mar 15 '23 at 12:02
  • Does this answer your question? [Flutter app build fails when trying to use flavors](https://stackoverflow.com/questions/57875134/flutter-app-build-fails-when-trying-to-use-flavors) – Elias Fazel Mar 15 '23 at 12:12

4 Answers4

1

Consider removing x86 because flutter doesn't support it . and it will work fine.

put this :

release {
            minifyEnabled false
            zipAlignEnabled false
            shrinkResources false
            signingConfig signingConfigs.release
            ndk.abiFilters 'x86_64', 'armeabi-v7a', 'arm64-v8a'
        }

instead of this :

release {
            minifyEnabled false
            zipAlignEnabled false
            shrinkResources false
            signingConfig signingConfigs.release
            ndk.abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
        }
0

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

  android.bundle.enableUncompressedNativeLibs=false
FetFrumos
  • 5,388
  • 8
  • 60
  • 98
0

enter image description hereRemoved the ndk.abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'

Automatically showing google play store and apk install

buildTypes { release { debuggable fale /// upload apk false minifyEnabled false shrinkResources false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } }

enter image description here

0

ndk.abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' why do you need abi filters? Did you try removing the above line?

Saiful Sazib
  • 451
  • 1
  • 3
  • 14