Reputation:
Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:25.0.1
Error:(23, 24) Failed to resolve: com.android.support.test.espresso:espresso-core:2.0
Here is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.example.jignesh.myapplication"
minSdkVersion 25
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
testCompile 'junit:junit:4.12'
}
Upvotes: 6
Views: 32799
Reputation: 1
dependencies {
// compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
// testCompile 'junit:junit:4.12' }
Upvotes: -2
Reputation: 2165
See In your SDK tools which SKD you already Downloaded. And choice one of them like 21.3.4 ... note: must get below of buildToolsVersion and compiler your project.
Upvotes: 0
Reputation: 91
Issue resolved on commenting some lines in gradle
dependencies {
// compile fileTree(dir: 'libs', include: ['*.jar'])
// androidTestCompile('com.android.support.alert_dialog.espresso:espresso-core:2.2.2', {
// exclude group: 'com.android.support', module: 'support-annotations'
// })
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
// testCompile 'junit:junit:4.12'
}
Upvotes: 1
Reputation: 73
you can use:
maven {
url "https://maven.google.com"
}
and it would solve the problem but I don't think its the most efficient way because when you do this you'll probably be getting rendering errors or warning on your activity.xml page and you don't want to risk that.
another way to solve this is to go to
tools ==> appearance and behavior ==> system settings ==> android SDK ==> SDK platforms and untick all android versions listed above android 7.0(Nougat).
close android studio and restart your project.
I use android 2.2 and have not upgraded to the latest so this solution might be different and not work on other android studio versions.
I hope this helps.
cheers
Upvotes: 0
Reputation: 3278
You have to use maven repository too in your project gradle file -
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
And sync your project, it will work :-)
Upvotes: 2
Reputation: 1283
I honestly don't understand why this is not automatically catered for when you create a new project... Solution is to add
maven {
url "https://maven.google.com"
}
under allprojects => repositories in project level build.gradle
Upvotes: 1
Reputation: 666
Open SDK Manager -> Appearance & Behavior -> System Settings-> Android SDK
Download all the required platforms.
Thanks
Upvotes: 0
Reputation: 295
In android studio, tools->android->sdk manager->sdk tools-> update a android support repository rev 41.
Upvotes: 1
Reputation: 11255
Add the below line to your build.gradle
.
androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2.2'){
exclude module: 'support-annotations'
exclude module: 'support-v4'
exclude module: 'support-v13'
exclude module: 'recyclerview-v7'
exclude module: 'appcompat-v7'
}
Another Approach to solve this.
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:23.0.1'
}
}
Hope this will solve your problem.
Upvotes: 0
Reputation: 31
The Espresso version you are using is outdated. You need to add the following version -
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
Please check their documentation - Espresso Docs
Upvotes: 0