Reputation: 7214
I'm trying to use an old version of appcompat-v7. My build.gradle has the following lines:
dependencies {
compile 'com.android.support:appcompat-v7:21.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:8.4.0'
}
The full build.gradle is below:
import com.android.build.gradle.AppExtension
apply plugin: 'com.android.application'
final def extension = android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example."
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
extension
dependencies {
compile 'com.android.support:appcompat-v7:21.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:8.4.0'
}
However, when running it gives me the error:
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'. Could not find com.android.support:appcompat-v7:23.0.0. Searched in the following locations: [removed links] file:/C:/Users/j/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom file:/C:/Users/j/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.aar file:/C:/Users/j/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom file:/C:/Users/j/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.aar Required by: WaitroseStock:app:unspecified Could not find com.android.support:appcompat-v7:23.0.0. Searched in the following locations: https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.aar file:/C:/Users/j/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom file:/C:/Users/j/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.aar file:/C:/Users/j/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom file:/C:/Users/j/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.aar Required by: WaitroseStock:app:unspecified > com.google.android.gms:play-services:8.4.0 > com.google.android.gms:play-services-cast:8.4.0 > com.android.support:mediarouter-v7:23.0.0
This is because I have deleted version 23 so it doesn't confuse itself with that newer version and cause errors. Why is it still looking for v23 when I have requested v21?
Upvotes: 2
Views: 1030
Reputation: 917
Try this...
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "your package name"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.google.android.gms:play-services:8.4.0'
}
Restart your android studio and rebuild the project. Hope this will help you...
Upvotes: 0