解决编译异常问题 This support library should not use a different version(x)than the compileSdkVersion(y)

This support library should not use a different version(x)than the compileSdkVersion(y)

转载请注明来源李岳锋的博客

与这个错误是同个原理的,请举一反三:This support library should not use a different version(x)than the targetSdkVersion(y)。一个是编译版本不一致,一个是目标版本不一致。

1、com.android.support:recyclerview-v7:x.x.x 
2、com.android.support:recyclerview-v7:x.x.x 
3、com.android.support:support-v4:x.x.x 
4、com.android.support:support-v7:x.x.x 
…. 
在导入这些包之后,报了这个错This support library should not use a different version(x)than the compileSdkVersion(y)。 
原因是你的compileSdkVersion版本(即编译版本)与你所导入的support包的版本不同。如果你的编译版本的API是23。那你导入的support包对应的API也应该是:23.x.x。

以要导入V7包,然后编译版本的API为24为例: 
则导入的应该是 compile ‘com.android.support:support-v7:24.x.x’ 
至于24后面的x.x,是指24版下的子版本,是多少就无所谓了。我现在要导入的是: 
compile ‘com.android.support:recyclerview-v7:24.1.1’是这个。而且编译版本的API是24.

版权声明:本文为博主原创文章,未经博主允许,也可以随意转载。但麻烦,加个友情链接,增加点人气。 https://blog.csdn.net/l_o_s/article/details/56677006
文章标签:  android
个人分类:  android 开发

猜你喜欢

转载自blog.csdn.net/li_yu_csdn/article/details/80279240