简体   繁体   中英

Gradle error while adding dependencies

I want to add a card view so that I want to add dependencies (got from google search) when the time of adding dependencies

   compile 'com.android.support:cardview-v7:21.0.+'

屏幕截图

I am getting gradle error saying that

This support library should not use a different version (21) than the compileSdkVersion (23) less... (Ctrl+F1) There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)

Change your CardView dependency to:

compile 'com.android.support:cardview-v7:23.1.1'

You cannot have a different compile SDK version to versions of the support library.

You used sdk version 23 for your project, but you use version 21 for cardview. If you compile with cardview-v7:23 there should not be a problem any more. It is also a good idea to update the support libraries, if this does not help.

Edit: As I see the picture you posted, you can see that you use 23.1.1 for the other dependencies, but 21.0.+ for the others. Change 21.0.+ to 23.1.1

compile 'com.android.support:cardview-v7:23.0.1'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM