Android Studio 报错:Could not find com.android.support:appcompat-v7:28.0.0-beta01.
报错内容如下,
Could not find com.android.support:appcompat-v7:28.0.0-beta01.
Searched in the following locations:
file:/D:/AndroidSDK/extras/m2repository/com/android/support/appcompat-v7/28.0.0-beta01/appcompat-v7-28.0.0-beta01.pom
file:/D:/AndroidSDK/extras/m2repository/com/android/support/appcompat-v7/28.0.0-beta01/appcompat-v7-28.0.0-beta01.jar
file:/D:/AndroidSDK/extras/google/m2repository/com/android/support/appcompat-v7/28.0.0-beta01/appcompat-v7-28.0.0-beta01.pom
file:/D:/AndroidSDK/extras/google/m2repository/com/android/support/appcompat-v7/28.0.0-beta01/appcompat-v7-28.0.0-beta01.jar
file:/D:/AndroidSDK/extras/android/m2repository/com/android/support/appcompat-v7/28.0.0-beta01/appcompat-v7-28.0.0-beta01.pom
file:/D:/AndroidSDK/extras/android/m2repository/com/android/support/appcompat-v7/28.0.0-beta01/appcompat-v7-28.0.0-beta01.jar
https://jcenter.bintray.com/com/android/support/appcompat-v7/28.0.0-beta01/appcompat-v7-28.0.0-beta01.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/28.0.0-beta01/appcompat-v7-28.0.0-beta01.jar
Required by:
project :app
Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager
首先想到的是换版本,在app->build.gradle中进行各种尝试,如
implementation 'com.android.support:appcompat-v7:27.1.1'
都不成功,最后把原来的项目拉出来,发现新项目project->build.gradle的repositories中都有google(),于是加上,问题解决。与app->build.gradle无关。
注意看全文,其中有两处必须都有google(),如下
// 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.1.3'
// 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
}