无法密封APK,Visual Studio赢得了构建apk

时间:2018-02-02 16:33:41

标签: android visual-studio apk keystore android-keystore

嘿伙计们,

在我的visual studio中尝试构建一个已签名的apk时,我遇到了一些错误:

BUILD FAILED

Total time: 2.284 secs

1>MSBUILD : cordova-build error : FAILURE: Build failed with an exception.
1>MSBUILD : cordova-build error : * What went wrong:
1>MSBUILD : cordova-build error : Execution failed for task ':packageRelease'.
1>MSBUILD : cordova-build error : > Failed to seal APK
1>MSBUILD : cordova-build error : * Try:
1>MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Command finished with error code 1: cmd /s /c ""C:\Users\poehler\Documents\Visual Studio 2017\Projects\DividendenApp\DividendenApp\platforms\android\gradlew.bat" cdvBuildRelease -b "C:\Users\poehler\Documents\Visual Studio 2017\Projects\DividendenApp\DividendenApp\platforms\android\build.gradle" -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
1>MSBUILD : cordova-build error : Error: cmd: Command failed with exit code 1 Error output:
1>MSBUILD : cordova-build error : FAILURE: Build failed with an exception.


1>MSBUILD : cordova-build error : * What went wrong:
1>MSBUILD : cordova-build error : Execution failed for task ':packageRelease'.
1>MSBUILD : cordova-build error : > Failed to seal APK
1>MSBUILD : cordova-build error : * Try:
1>MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
1>MSBUILD : cordova-build error : Picked up _JAVA_OPTIONS: -Xmx512M

我创建了我的密钥库文件,如下所示: http://taco.visualstudio.com/en-us/docs/tutorial-package-publish-readme/

我还编辑了我的build.json:

{
     "android": {
        "release": {
            "alias": "myname",
            "keystore": "C:\\mykey.keystore",
            "keystoreType": "",
            "password": "key",
            "storePassword": "key"
        }
     }
 }

我的ant.properties看起来像这样:

key.store=C:\\mykey.keystore
key.alias=myname
key.store.password=key
key.alias.password=key

你们有什么建议吗?

2 个答案:

答案 0 :(得分:3)

我找到了解决方案,你必须增加密钥大小 2048到4096

keytool -genkey -v -keystore c:\my-release-key.keystore -alias ABC -keyalg RSA -keysize 4096 -validity 100000

答案 1 :(得分:-1)

所以我找到了解决这个问题的方法。

只需转到cordova目录并输入

即可
cordova build -release android

这个对我有用。