我已经在Android Studio中生成已签名的APK(Build - > Generate Signed APK)一段时间了,但今天早上我尝试使用以下命令从命令提示符(Windows)创建一个:
gradlew assembleRelease
我在很长一段时间后取消了执行此操作,因为它在解压级文件时似乎卡住了。
在此之后,我无法再在Android Studio中生成已签名的APK,也无法使用上述命令执行此操作。
而只在app-release.apk
/app/build/outputs/apk/
奇怪的是,即使我在上面的命令中添加了--info或--debug标志,我也看不到任何错误,例如:这是执行gradlew assembleRelease --info
生成的最后一行数:
:app:processReleaseJavaRes UP-TO-DATE
:app:processReleaseJavaRes (Thread[main,5,main]) completed. Took 0.002 secs.
:app:transformResourcesWithMergeJavaResForRelease (Thread[main,5,main]) started.
:app:transformResourcesWithMergeJavaResForRelease
Skipping task ':app:transformResourcesWithMergeJavaResForRelease' as it is up-to-date (took 0.011 secs).
:app:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:app:transformResourcesWithMergeJavaResForRelease (Thread[main,5,main]) completed. Took 0.013 secs.
:app:validateSigningRelease (Thread[main,5,main]) started.
:app:validateSigningRelease
Executing task ':app:validateSigningRelease' (up-to-date check took 0.0 secs) due to:
Task has not declared any outputs.
:app:validateSigningRelease (Thread[main,5,main]) completed. Took 0.001 secs.
:app:packageRelease (Thread[main,5,main]) started.
:app:packageRelease
Executing task ':app:packageRelease' (up-to-date check took 0.024 secs) due to:
Value of input property 'signingConfig.class' has changed for task ':app:packageRelease'
All input files are considered out-of-date for incremental task ':app:packageRelease'.
Unable do incremental execution: full task run
:app:packageRelease (Thread[main,5,main]) completed. Took 2.284 secs.
:app:assembleRelease (Thread[main,5,main]) started.
:app:assembleRelease
Skipping task ':app:assembleRelease' as it has no actions.
:app:assembleRelease (Thread[main,5,main]) completed. Took 0.0 secs.
BUILD SUCCESSFUL
Total time: 18.828 secs
Stopped 0 compiler daemon(s).
这两行看起来很可疑:
Executing task ':app:validateSigningRelease' (up-to-date check took 0.0 secs) due to:
Task has not declared any outputs.
...但除此之外,不知道为什么没有生成APK的签名版本。
我查看了每个Stackoverflow问题,到目前为止我还没有任何工作。任何帮助将不胜感激。
答案 0 :(得分:0)
例如,以下build.gradle
指令在没有明显错误消息的情况下有效:
android {
...
signingConfigs {
release {
storeFile file("release.keystore")
keyAlias "myalias"
storePassword "xxxxxx"
}
}
...
}
但这还不够。这里keyPassword
丢失了。您需要完整的指令集:
android {
...
signingConfigs {
release {
storeFile file("release.keystore")
keyAlias "myalias"
storePassword "xxxxxx"
keyPassword "xxxxxx"
}
}
...
}