Android API28:All com.android.support libraries must use the exact same version specification

最近将sdk版本下载至最新的API 28,将compileSdkVersion改为28后,并将官方支持库改为相应版本时:

def support_version = "28.0.0-alpha3"
implementation "com.android.support:appcompat-v7:$support_version"

提示有错误,错误详情为:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-alpha3, 27.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0-alpha3 and com.android.support:recyclerview-v7:27.1.0 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).


我的解决方法是将所提示缺少的部分(animated-vector-drawablerecyclerview-v7)添加进去并使用相同的版本号,添加后的代码如下:

def support_version = "28.0.0-alpha3"
implementation "com.android.support:appcompat-v7:$support_version"
implementation "com.android.support:support-v4:$support_version"
implementation "com.android.support:recyclerview-v7:$support_version"

你可能感兴趣的:(android开发问题)