Android Studio在添加gradle仓库时,给出了 "无效变量名。必须以字母开头"

问题描述 投票:0回答:1

我正在尝试将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' }

android maven android-studio gradle build
1个回答
0
投票

原来,语法

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

由于某些原因不支持。我已经通过添加 () 围绕着网址。

maven​ { ​url​(​"https://chartboostmobile.bintray.com/Chartboost"​) }
© www.soinside.com 2019 - 2024. All rights reserved.