简体   繁体   English

Android Gradle构建版本在密钥库中找不到别名

[英]Android gradle build release not finding alias in keystore

I am attempting to use Cordova to build in release. 我正在尝试使用Cordova构建发行版。 I have release-signing.properties declared in platforms/android with the following content: 我在platform / android中声明了release-signing.properties,内容如下:

storeFile=../../release-key.jks
storePassword=<password>
storeType=pkcs12
keyAlias=<alias>
keyPassword=<password>

Using either: 使用以下任一方法:

cordova build android --release

or just using gradle: 或仅使用gradle:

./gradlew.bat signingReport

Both report an issue building for release: 两者都报告有待发布的问题:

Failed to read key mmrevision from store "<full_path>\platforms\android\..\..\release-key.keystore": DerInputStream.getLength(): lengthTag=109, too big.

I generated the key with: 我生成了密钥:

/C/Program\ Files\ \(x86\)/Java/jre1.8.0_65/bin/keytool.exe -genkey -v -keystore release-key.jks -alias mmrevision -keyalg RSA -keysize 2048 -validity 36500

My issue was that, I generated the key as androids documentation suggests, but I copied the config for release-signing from cordova's documentation. 我的问题是,我按照androids文档的建议生成了密钥,但我从cordova的文档中复制了用于发布签名的配置。

The flaw in this is that cordova listed the storeType as "pkcs12" while the keytool command I used generates a jks keystore! 这样做的缺陷是cordova将storeType列为“ pkcs12”,而我使用的keytool命令生成了jks密钥库!

Change: 更改:

storeType=pkcs12

To: 至:

storeType=jks

Also note: 另请注意:

In cordova it is now better to use build.json. 在cordova中,现在最好使用build.json。 In the root of your cordova project add a file called "build.json" with content like: 在您的cordova项目的根目录中,添加一个名为“ build.json”的文件,其内容如下:

{
    "android": {
        "debug": {
            ... (if not specified, the apk cannot be signed in debug, but cordova run android should still work)
        },
        "release": {
            "keystore": "release-key.jks",
            "storePassword": "<password>",
            "alias": "<alias>",
            "password" : "<password>",
            "keystoreType": "jks"
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM