I am having this issue in Android studio.
Error:(22, 13) Failed to resolve: com.android.support:appcompat-v7:26.0.0
Install
If you are using Android Studio 3.0, add the Google maven repository as shown below:
allprojects {
repositories {
jcenter()
google()
}
}
Go to SDK path: SDK\extras\android\m2repository\com\android\support\appcompat-v7
to see correct dependency name, then change name if your dependency is alpha version:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.0.0'
}
to :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
}
File -> Project Structure -> Modules (app) -> Open Dependencies Tab -> Remove all then use +
to add from the proposed list.
Please be noted, we need to add google maven to use support library starting from revision 25.4.0. As in the release note says:
Important: The support libraries are now available through Google's Maven repository. You do not need to download the support repository from the SDK Manager. For more information, see Support Library Setup.
Read more at Support Library Setup.
Play services
and Firebase
dependencies since version 11.2.0 are also need google maven. Read Some Updates to Apps Using Google Play services and Google APIs Android August 2017 - version 11.2.0 Release note.
So you need to add the google maven to your root build.gradle
like this:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
For Gradle build tools plugin version 3.0.0, you can use google()
repository (more at Migrate to Android Plugin for Gradle 3.0.0):
allprojects {
repositories {
jcenter()
google()
}
}
UPDATE:
From Google's Maven repository:
The most recent versions of the following Android libraries are available from Google's Maven repository:
To add them to your build, you need to first include Google's Maven repository in your top-level / root build.gradle
file:
allprojects {
repositories {
google()
// If you're using a version of Gradle lower than 4.1, you must instead use:
// maven {
// url 'https://maven.google.com'
// }
// An alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
Then add the desired library to your module's dependencies block. For example, the appcompat
library looks like this:
dependencies {
compile 'com.android.support:appcompat-v7:26.1.0'
}
However, if you're trying to use an older version of the above libraries and your dependency fails, then it's not available in the Maven repository and you must instead get the library from the offline repository.
you forgot to add add alpha1 in module area
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
use maven repository in project area that's it
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
I was facing the same issue but I switched 26.0.0-beta1 dependencies to 26.1.0 and it's working now.