android - Android Studio adding gradle repository gives "Invalid variable name. Must start with a letter"
问题描述
I am trying to add Charboost maven repository to my build.gradle
. I am following their docs which say to do
repositories {
maven { url "https://chartboostmobile.bintray.com/Chartboost" }
}
I already have and it works:
repositories {
jcenter()
google()
flatDir {
dirs 'libs'
}
}
But when I add maven { url "https://chartboostmobile.bintray.com/Chartboost" }
I get
Could not compile build file '.../build.gradle'.
> startup failed:
build file '.../build.gradle': _: Invalid variable name. Must start with a letter but was:
. At line _, column _.
maven { url 'https://chartboostmobile.bintray.com/Chartboost' }
^
I've tried doing this with com.android.tools.build:gradle:3.1.3
and 4.+
and I also tried apply plugin: 'maven'
and plugin { id 'maven' }
解决方案
Turns out, that the syntax
maven { url "https://chartboostmobile.bintray.com/Chartboost" }
is for some reason not supported. I have fixed it by adding ()
around the url:
maven { url("https://chartboostmobile.bintray.com/Chartboost") }
推荐阅读
- javascript - 无法在本机反应中访问箭头函数之外的变量
- c# - 使用 C# 和 SQL Server 数据库在 WinForms 的图表中添加第 2 个系列/条形图
- php - 为什么 Laravel Upsert 会调整 auto_increment 值?
- json - 从 Spring Boot RestController 返回一个内部 json 字符串
- java - Quarkus 创建类运行时并解决依赖关系
- google-apps-script - 如何授予对第三方应用程序的访问权限
- swift - 无法快速更改侧边菜单语言?
- bash - 如何在 Bash Shell 中获得一周中给定年份的第一天?
- python - 缩短 Sphinx 中 Python 类型注释的显示格式
- sql - 始终加密:如何插入加密列?