android - 我的 build.gradle 与第 22 行中的错误不兼容
问题描述
我使用 keytool 生成了我的密钥并将其粘贴到 android/app 文件夹中,但是运行命令 ./gradlew assembleRelease 会返回错误:
➜ android git: (master) / ./gradlew assembleRelease
FAILURE:构建失败并出现异常。
- Onde:构建文件'/Volumes/Projects/Apps/calculator/android/build.gradle'行:22
我的 build.gradle 与文档不同,附上我展示了我的 build.gradle
// 顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。
buildscript {
ext {
buildToolsVersion = "28.0.2"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
android { // line 22
signingConfigs {
release {
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
}
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.7'
distributionUrl = distributionUrl.replace("bin", "all")
}
构建文件“/Volumes/Projetos/Apps/calculator/android/build.gradle”行:22
解决方案
将以下行添加到 /android 文件夹中的 gradle.properties 文件中
MYAPP_UPLOAD_STORE_FILE=youkeystorefilenamehere.keystore
MYAPP_UPLOAD_KEY_ALIAS=yourkeyalias
MYAPP_UPLOAD_STORE_PASSWORD=yourstorepassword
MYAPP_UPLOAD_KEY_PASSWORD=yourkeypassword
推荐阅读
- javascript - 将 JSF bean 值传递给 javascript 函数
- java - @PreDestroy 挂钩处的 Spring 计划任务状态
- ssas - 无法浏览多维数据集。验证多维数据集是否已部署和处理。(微软 SQL Server 管理工作室)
- matlab - Matlab图像图
- python - ValueError:最大值必须大于范围参数中的最小值
- node.js - Knex 正在返回检测到死锁
- json - 对 CSVW 元数据属性使用 JSON-LD 语言映射
- pine-script - 为什么 sma 与 pinescript 的 for 循环中的 wma 如此不同?
- android - 如何使用分页库在 Leanback VerticalGridSupportFragment 中实现分页?
- javascript - 活动菜单选项卡