当我构建一个发布 .abb flutter 应用程序时,我遇到了一个问题,我花了两个多星期的时间寻找解决这个问题的方法,但这些解决方案都没有奏效,所以我希望你能帮助我。
* What went wrong:
Execution failed for task ':app:signReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Failed to read key final.jks from store "D:\keys\final.jks": No key with alias 'final.jks' found in keystore D:\keys\final.jks
我尝试过的解决方案:build.gradle
classpath 'com.android.tools.build:gradle:4.1.0'
更改为classpath 'com.android.tools.build:gradle:3.5.0'
C:
更改为 D:/android/app
更改为/android
.gradle
驱动中的主要C:
文件,通过Android Studio
重新下载这是
/android/build.gradle
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是/android/app/build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 30
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.counter"
minSdkVersion 16
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
key.properties
文件:storePassword=123456
keyPassword=123456
keyAlias=final.jks
storeFile=D:/keys/final.jks
我的 Android studio version is "Arctic Fox 2020.3.1"
和 flutter SDK version is 2.5
这是我的第一个应用程序,所以我希望你能帮助我,谢谢!
最佳答案
步骤 1
Place your final.jks file inside /android/app folder
步骤 2
关键属性
storePassword=123456
keyPassword=123456
keyAlias=final
storeFile=final.jks
关于android - 任务 :app:signReleaseBundle'A failure executing com. android.build.gradle.internal.tasks.Workers$ActionFacade 失败,无法从存储中读取 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69197448/