Flutter build apk --release failed

Viewed 680

My application worked well on emulator or real device if I run the app by IDE.

Now I want to build apk release version by command:

flutter clean 
flutter build apk --release

Run the output apk file, it's always error:

The APK failed to install. Error: Could not parse error string

enter image description here

Please help me to build correct release apk file

Flutter version:

Flutter 1.17.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f7a6a7906b (8 days ago) • 2020-05-12 18:39:00 -0700
Engine • revision 6bc433c6b6
Tools • Dart 2.8.2

Although I tried to configure release version in build.gradle as below:

This action already worked well for previous apps (now it is not).

android\app\build.gradle

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
-----android area---------
lintOptions {
    disable 'InvalidPackage'
    checkReleaseBuilds false
}
...........
signingConfigs {
    release {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile file(keystoreProperties['storeFile'])
        storePassword keystoreProperties['storePassword']
    }
}


buildTypes {
    release {
        signingConfig signingConfigs.release
        minifyEnabled true
        useProguard true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
-----android area---------

How can I fix the problem ?

Thanks in advance!!!

0 Answers
Related