【问题标题】:Android Studio adding gradle repository gives "Invalid variable name. Must start with a letter"Android Studio 添加 gradle 存储库给出“无效的变量名。必须以字母开头”
【发布时间】:2020-08-06 21:25:09
【问题描述】:

我正在尝试将 Charboost maven 存储库添加到我的 build.gradle。我正在关注他们说要做的文档

repositories​ {
      maven​ { ​url​ ​"https://chartboostmobile.bintray.com/Chartboost"​ }
}

我已经有了,它可以工作:

repositories {
  jcenter()
  google()
  flatDir {
    dirs 'libs'
  }
}

但是当我添加maven​ { ​url​ ​"https://chartboostmobile.bintray.com/Chartboost"​ } 时,我得到了

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'​ }
                        ^

我试过用com.android.tools.build:gradle:3.1.34.+ 来做这件事,我也试过apply plugin: 'maven'plugin { id 'maven' }

【问题讨论】:

  • 发布您的整个build.gradle

标签: android maven android-studio gradle build


【解决方案1】:

原来,语法

maven​ { ​url​ ​"https://chartboostmobile.bintray.com/Chartboost"​ }

由于某种原因不受支持。我已经通过在 url 周围添加 () 来修复它:

maven​ { ​url​(​"https://chartboostmobile.bintray.com/Chartboost"​) }

【讨论】:

    猜你喜欢
    • 2020-01-20
    • 2021-03-29
    • 2021-02-09
    • 1970-01-01
    • 2010-09-12
    • 1970-01-01
    • 2015-04-17
    • 1970-01-01
    • 2015-08-03
    相关资源
    最近更新 更多