This support library should not use a different version, error in build.gradle

34,716

Solution 1

Your compileSdkVersion is 23 in the build.gradle file but you're trying to use appcompat-v7:24.0.0 which is for API 24, so you should use appcompat-v7:23.x.y for API 23. If you still want to use appcompat-v7:24.0.0 then you should change the compileSdkVersion to 24

You should use this for compileSdkVersion 23:

compile 'com.android.support:appcompat-v7:23.4.0'

and this for compileSdkVersion 24 :

compile 'com.android.support:appcompat-v7:24.0.0'

Edit

If you work on Android Studio, then you probably don't need to worry about the latest version available, it'll let you know about the latest available version.

You can also check the latest versions available for every sdk version here

Solution 2

Yep, they must not be different. Change it to compile 'com.android.support:appcompat-v7:23.4.0'

Share:
34,716
Mahmood khan
Author by

Mahmood khan

Updated on July 09, 2022

Comments

  • Mahmood khan
    Mahmood khan almost 2 years

    There is one problem in my build.gradle. The error in the gradle is that ( compile 'com.android.support:appcompat-v7:24.0.0-beta1') on this line the error display that (This support library should not use a different version(24 ) then the compile sdk version 23)
    Any idea? And I used Android Studio 2.1.2 and the main problem is that in Android studio there is no android support library. pic is below

    enter image description here

  • Mahmood khan
    Mahmood khan about 8 years
    Thank you sir. i really appreciate and it work correctly
  • Borislav Kamenov
    Borislav Kamenov about 8 years
    No problem. :) I would appreciate if you mark this answer as correct.
  • Petar-Krešimir
    Petar-Krešimir over 7 years
    How can we know which versions are available for specific SDKs? Or we should just change compileSdkVersion once a newer version is available?
  • Louis Tsai
    Louis Tsai over 6 years
    @Petar-Krešimir you can check developer.android.com/topic/libraries/support-library/… for the latest version of support library, also Android Studio will remind you when there is a new version of support libraries available
  • Neeraj
    Neeraj about 6 years
    @Petar-Krešimir You could browse jcenter.bintray.com/com/android/support/appcompat-v7
  • Mahdi-Malv
    Mahdi-Malv almost 6 years
    @BorislavKamenov I'm asking a little late. But why? What if i set them different.
  • Borislav Kamenov
    Borislav Kamenov almost 6 years
    Because Google guarantee that the libraries with same version are working properly and issues/bugs may happened in case of incompatibilities between different versions. So its better and good practice to keep all of them with same version. Its even better to keep all of them to older version, instead of specifying different versions.
  • shareef
    shareef over 5 years
    now it shows , google play does not support SDK 23 !? in intellij and compile is not supported(obsuleter) should be changed to implementation in most cases