错误1;
* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file 'xxxxxxxxx/android/app/android/app/key/key.jks' not found for signing config 'release'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
错误2:
* What went wrong:
Execution failed for task ':app:packageRelease'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
> com.android.ide.common.signing.KeytoolException: Failed to read key sign from store 'xxxxxxxxx/android/app/android/app/key/key.jks' : Invalid keystore format
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
解决方法:
出现这样的问题,一般都是jks文件没有获取对,首先可以先检查build.gradle 里面对配置是否写正确,可以参考一下我的写法。
///配置打包文件
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
///配置打包文件
signingConfigs {
release {
// keyAlias keystoreProperties['sign']
// keyPassword keystoreProperties['zxcvbnm']
// storeFile file(keystoreProperties['/Users/ggboy/work/practice/noob_program/android/app/key/key.jks'])
// storePassword keystoreProperties['zxcvbnm']
keyAlias 'sign'
keyPassword 'zxcvbnm'
storeFile file('你自己的签名路径/key.jks')
storePassword 'zxcvbnm'
}
debug {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['你自己的签名路径/key.jks'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
重点来了 上面的配置文件,signingConfigs 一定要写在buildTypes 之前。 如果你确认,你的签名文件 和 build.gradle 里面的配置完全正确的话,接下来这样做,
- 你的签名不要放在项目文件夹里面,自己在其他盘新建文件夹存放签名,
- 使用绝对地址。
storeFile file(keystoreProperties['其他盘符的绝对路径/key.jks'])
这样的话基本都可以正确打包。
错误三
* What went wrong:
Execution failed for task ':flutter_baidu_mapapi_base:stripReleaseDebugSymbols'.
> No version of NDK matched the requested version 20.0.5594570. Versions available locally: 22.1.7171670
解决方案:
出现这个问题,就是Ndk版本不匹配,本地的版本是22的,但是项目需求是20的,降低版本就可以。 看我操作:
- 在as中打开
- 选择自己所需要的版本,就可以。
|