Flutter构建apk-发布失败

时间:2020-05-20 16:56:13

标签: android flutter apk

如果我通过IDE运行应用程序,则我的应用程序在模拟器或真实设备上运行良好

现在我要通过命令构建apk发行版:

flutter clean 
flutter build apk --release

运行输出的apk文件,总是错误:

APK无法安装。错误:无法解析错误字符串

enter image description here

请帮助我构建正确的发行版APK文件

Flutter版本:

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

尽管我尝试按以下方式在build.gradle中配置发行版:

此操作已经可以在以前的应用程序中很好地工作(现在不是)。

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---------

如何解决此问题?

提前谢谢!

0 个答案:

没有答案