找不到com.android.tools.build:gradle:3.0.1。来自Github的项目
我想在Android Studio中打开十个项目。然而,我有一个问题 我有错误 错误:找不到com.android.tools.build:gradle:3.0.1。 在以下位置搜索: 要求: 项目: 添加Google Maven存储库和同步项目 打开文件 我试图用这些方法来解决这个问题 然而,没有任何帮助,有人知道如何打开这个项目吗 更新: Android版本3.4.1 格雷德尔先生找不到com.android.tools.build:gradle:3.0.1。来自Github的项目,android,gradle,Android,Gradle,我想在Android Studio中打开十个项目。然而,我有一个问题 我有错误 错误:找不到com.android.tools.build:gradle:3.0.1。 在以下位置搜索: 要求: 项目: 添加Google Maven存储库和同步项目 打开文件 我试图用这些方法来解决这个问题 然而,没有任何帮助,有人知道如何打开这个项目吗 更新: Android版本3.4.1 格雷德尔先生 // Top-level build file where you can add configurat
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
allprojects {
repositories {
jcenter()
google()
}
}
检查顶级build.gradle中的存储库中是否存在google()
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
allprojects {
repositories {
jcenter()
google()
}
}
另外,如果你使用的是AndroidStudio 3.1或更高版本,你应该能够点击添加Google Maven repository and sync project
,允许AndroidStudio自行进行必要的修改并重新同步gradle 存储库中应该有google()
repo来搜索google存储库中的插件/库
另外,com.android.tools.build
的版本号应该与android Studio版本匹配。例如:对于Android studio 3.4.1,类路径依赖项应为:
classpath 'com.android.tools.build:gradle:3.4.1'
下面是build.gradle的修改代码
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我有一个3.4.1版本的android studio,我添加了maven。它不起作用。