问题描述
限时送ChatGPT账号..我正在尝试使用 Gradle 的项目在 Android Studio 中以发布模式测试具有 Build Variant 的应用程序.
I am trying to test an app with Build Variant in release mode in Android Studio with a project using Gradle.
build.gradle:
build.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
}
}
}
如果 Build Variant 是 release Gradle 返回错误
If the Build Variant is release Gradle returns an error
发现任务配置有问题':app:packageRelease'.
A problem was found with the configuration of task ':app:packageRelease'.
文件'/Users/andre/workspace/MobileAndroid/app/release.jks'为属性signingConfig.storeFile"指定的不存在.
File '/Users/andre/workspace/MobileAndroid/app/release.jks' specified for property 'signingConfig.storeFile' does not exist.
删除signingConfig.storeFile"会返回一个 Android Studio 消息框错误:
Removing "signingConfig.storeFile" returns an Android Studio message box error:
应用程序安装失败
安装失败,因为 APK 未签名或已签名不正确.如果这是一个基于 Gradle 的项目,那么请确保签名配置在 Gradle 构建脚本中指定.
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.
release.jks 存在并且使用 Android Studio 向导Build > Generate Signed APK..."我可以生成一个 app.apk 签名.
release.jks exists and using the Android Studio wizard "Build > Generate Signed APK..." I can generate an app.apk signed.
如何解决 Gradle 中的这个错误?
How do I solve this error in Gradle?
推荐答案
请仔细检查该文件是否存在于错误消息所在的位置 (Users/andre/workspace/MobileAndroid/app/release.jks) 并且不存在阻止读取文件的权限问题.
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.
这篇关于带有 packageRelease 的 Gradle 签名应用程序“为不存在的属性‘signingConfig.storeFile’指定"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论