带有 packageRelease 的 Gradle 签名应用程序“为不存在的属性‘signingConfig.storeFile’指定"

编程入门 行业动态 更新时间:2024-10-13 12:18:59
本文介绍了带有 packageRelease 的 Gradle 签名应用程序“为不存在的属性‘signingConfig.storeFile’指定"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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:关键词]

本文发布于:2023-04-15 05:22:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/857528.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不存在   应用程序   属性   Gradle   packageRelease

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!