Android Studio 3.1:混合版本可能导致运行时崩溃 [英] Android Studio 3.1: mixing versions can lead to runtime crashes

查看:70
本文介绍了Android Studio 3.1:混合版本可能导致运行时崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近已升级到Android Studio 3.1,同时我正在尝试Android P预览.

Have recently upgraded to Android Studio 3.1, and at the same time I'm trying the Android P preview.

我在编译时遇到以下错误:

I'm getting the following error on compiling:

所有com.android.support库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃).找到版本28.0.0-alpha1,26.1.0.例子包括com.android.support:animated-vector-drawable:28.0.0-alpha1和com.android.support:support-media-compat:26.1.0 less ...(Ctrl + F1) 有一些库,工具或库的组合不兼容或可能导致错误.一种不兼容的情况是使用不是最新版本(或特别是低于targetSdkVersion的版本)的Android支持库版本进行编译.

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

但是我在任何地方都看不到26.1.0的任何实例.我所拥有的只是:

But I cannot see any instance of 26.1.0 anywhere. All I have in my gradle is:

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0-alpha1'

我曾尝试清除缓存,重建应用程序等.但是错误仍然存​​在.

I've tried clearing caches, rebuilding app, etc. But error remains.

推荐答案

您需要通过将冲突的库添加到依赖项块中来覆盖冲突的库

You need to override the conflicted libraries by adding the conflicted libraries to your dependencies block

dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:customtabs:28.0.0-alpha1'
implementation 'com.android.support:support-vector-drawable:28.0.0-alpha1'
implementation 'com.android.support:support-media-compat:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0-alpha1'

这篇关于Android Studio 3.1:混合版本可能导致运行时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆