17

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

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Mahmood khan
  • 191
  • 1
  • 1
  • 6

2 Answers2

26

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

Ashish Ranjan
  • 5,523
  • 2
  • 18
  • 39
  • 8
    How can we know which versions are available for specific SDKs? Or we should just change compileSdkVersion once a newer version is available? – Petar-Krešimir Oct 27 '16 at 16:57
  • @Petar-Krešimir you can check https://developer.android.com/topic/libraries/support-library/revisions.html for the latest version of support library, also Android Studio will remind you when there is a new version of support libraries available – Louis Tsai Nov 07 '17 at 15:39
  • @Petar-Krešimir You could browse https://jcenter.bintray.com/com/android/support/appcompat-v7/ – Neeraj May 29 '18 at 13:29
  • 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 – shareef Jan 02 '19 at 19:53
4

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

Borislav Kamenov
  • 561
  • 4
  • 12
  • Thank you sir. i really appreciate and it work correctly – Mahmood khan Jun 28 '16 at 09:32
  • No problem. :) I would appreciate if you mark this answer as correct. – Borislav Kamenov Jun 28 '16 at 09:44
  • @BorislavKamenov I'm asking a little late. But why? What if i set them different. – Mahdi-Malv Sep 24 '18 at 07:17
  • 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. – Borislav Kamenov Sep 25 '18 at 21:09