构建Appbundle(Flutter)时密钥库密码不正确

时间:2019-09-17 00:34:04

标签: android gradle flutter dart android-app-bundle

所以我当前正在尝试创建Appbundle,以便可以将我的应用上传到Google Play商店。不幸的是,我在项目的签名发布部分遇到了问题。以下是来自终端的错误副本:

private $array = [];
private function prepareFields(array $fields):array
{
    foreach($fields as $key => $value)
    {
        if(is_array($value))
        {
            $this->array[] = $key;
            $this->array[$key] = $this->prepareFields($value);
        }
        else
        {
            $this->array[] = $key;
        }
    }

    return $this->array;
}

此错误背后的思考过程是,设置我的key.properties或app / build.gradle时出现错误。以下是两个文件:

FAILURE: Build failed with an exception.                                

* What went wrong:                                                      
Execution failed for task ':app:packageRelease'.                        
> com.android.ide.common.signing.KeytoolException: Failed to read key key from store "/Users/herb/Downloads/morningly/android/app/key.jks": keystore password was incorrect
Key.properties

storePassword=<REDACTED> keyPassword=<REDACTED> keyAlias=key storeFile=key.jks

app/build.gradle

我仔细检查了一下,我知道密码正确,但是如果仍然有需要替换的话,那可能会有所帮助。拜托,如果您有任何意见,请告诉我。我非常想尽快上传该应用程序。

1 个答案:

答案 0 :(得分:1)

您的错误密钥库密码不正确

关于不带<>

的Key.properties

删除<>

storePassword=password
keyPassword=password
keyAlias=key
storeFile=key.jks

关于app / build.gradle

您错过了很多

signingConfigs {
    release {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile file(keystoreProperties['storeFile'])
        storePassword keystoreProperties['storePassword']

那是我的文件更改applicationId

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

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.your bannel"
        minSdkVersion 18
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
apply plugin: 'com.google.gms.google-services'

否则

您能否将google连接到rest键,并在允许后创建新的

https://support.google.com/googleplay/android-developer/contact/otherbugs