Android 带有 packageRelease 的 Gradle 签名应用程序“为属性 'signingConfig.storeFile' 指定不存在”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21780847/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Gradle signing app with packageRelease “specified for property 'signingConfig.storeFile' does not exist”
提问by André Ricardo
I am trying to test an app with Build Variant in release mode in Android Studio with a project using Gradle.
我正在尝试使用 Gradle 的项目在 Android Studio 中以发布模式测试具有 Build Variant 的应用程序。
build.gradle:
构建.gradle:
(omitted dependencies and repositories)
android {
apply plugin: 'android'
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 11
targetSdkVersion 16
versionCode 1
versionName "1.0"
}
signingConfigs {
release {
storeFile file("release.jks")
storePassword "password"
keyAlias "MobileAndroid"
keyPassword "password"
}
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
}
}
If the Build Variant is release Gradle returns an error
如果 Build Variant 是 release Gradle 会返回错误
A problem was found with the configuration of task ':app:packageRelease'.
File '/Users/andre/workspace/MobileAndroid/app/release.jks' specified for property 'signingConfig.storeFile' does not exist.
发现任务 ':app:packageRelease' 的配置有问题。
为属性“signingConfig.storeFile”指定的文件“/Users/andre/workspace/MobileAndroid/app/release.jks”不存在。
Removing "signingConfig.storeFile" returns an Android Studio message box error:
删除“signingConfig.storeFile”会返回一个 Android Studio 消息框错误:
Application Installation Failed
Installation failed since the APK was either not signed, or signed incorrectly. If this is a Gradle-based project, then make sure the signing configuration is specified in the Gradle build script.
应用程序安装失败
安装失败,因为 APK 未签名或签名不正确。如果这是一个基于 Gradle 的项目,那么请确保在 Gradle 构建脚本中指定了签名配置。
release.jks exists and using the Android Studio wizard "Build > Generate Signed APK..." I can generate an app.apk signed.
release.jks 存在并且使用 Android Studio 向导“Build > Generate Signed APK...”我可以生成一个 app.apk 签名。
How do I solve this error in Gradle?
我如何解决 Gradle 中的这个错误?
回答by Scott Barta
Please double-check that the file exists at the place the error message is looking (Users/andre/workspace/MobileAndroid/app/release.jks) and that there are no permissions problems preventing the files from being read.
请仔细检查该文件是否存在于错误消息所在的位置(Users/andre/workspace/MobileAndroid/app/release.jks),并且没有阻止读取文件的权限问题。
回答by j2emanue
For me it was because i was entering in just the name of the key when it was asking for the full path.
对我来说,这是因为我在要求完整路径时只输入了密钥的名称。
回答by Ash
Might be helpful for someone - I was getting the same message "specified for property 'signingConfig.storeFile' does not exist”
可能对某人有帮助 - 我收到相同的消息“为属性 'signingConfig.storeFile' 指定不存在”
Somehow in my case when i changed laptops keystore files got corrupted/tempered while transferring it from one to another. I would suggest not to zip the file, Just transfer it as it is.
不知何故,当我更换笔记本电脑时,密钥库文件在从一个传输到另一个时被损坏/调整。我建议不要压缩文件,只需按原样传输即可。
When i transferred again without zipping, It worked like a charm!!!
当我在没有拉链的情况下再次转移时,它就像一个魅力!!!
回答by Arjun Sadafule
If you want to create signed version of apk then it requires release. If you don't want to, choose the debug mode and run the unsigned apk file.
如果您想创建签名版本的 apk,则需要发布。如果您不想,请选择调试模式并运行未签名的 apk 文件。