Reputation: 1038
I'm trying to make an app using the android support library, so if I start a new project with a basic activity, then add the android support library using the dependencies menu, I get this error:
This support library should not use a different version (24) than the `compileSdkVersion` (23)
This is what my gradle file looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.example.moore.criminalintent"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:24.0.0'
}
I've not touched any other settings apart from creating the project and adding the dependency. Any help in resolving this would be greatly appreciated.
Upvotes: 0
Views: 3895
Reputation: 395
If your using compile SDK version 24 than you should use it as
compile 'com.android.support:support-v4:24.0.0'
Upvotes: 0
Reputation: 365028
Since you are using the support libraries v24.
compile 'com.android.support:support-v4:24.0.0'
You have to compile with API 24. Use:
compileSdkVersion 24
Upvotes: 3
Reputation: 1983
Change compile 'com.android.support:support-v4:24.0.0'
to compile 'com.android.support:support-v4:23+'
(and optionally provide a sub version. The plus means the latest version of 23.something will be used).
This error is caused because you are compiling against API version 23 (android M), so you cannot use the support library version 24. Version 24 of the support library is for the recently released Android N developer preview, from my understanding.
Alternatively, you could of coarse increase your compile SDK version to 24.
Upvotes: 0