android - Android Studio,不匹配支持库版本错误,但不知道它在哪里指定
问题描述
在 Android Studio 中进行项目,并收到此错误:
com.android.support 库必须使用完全相同的版本规范。
找到版本 com.android.support:support-compat:25.2.0 和 com.android.support:app-compat-v7:22.2.1
但是问题是,我的 build.gradle 文件中没有对 com.android.support:support-compat:25.2.0 的引用
那么,我在哪里可以找到这种依赖关系的来源?这是我的依赖项:
模块构建
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':lvl')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services-maps:11.6.0'
compile 'com.google.android.gms:play-services-location:11.6.0'
compile 'com.google.android.gms:play-services-auth:11.6.0'
compile 'org.jsoup:jsoup:1.10.3'
compile 'com.google.apis:google-api-services-oauth2:v1-rev143-1.24.1'
compile 'com.google.maps.android:android-maps-utils:0.4'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.volley:volley:1.1.0'
compile 'com.android.support:design:22.2.1'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:support-v4:22.2.1'
}
项目建设:
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
我很困惑。这个 25.2.0 支持依赖来自哪里?我该如何摆脱它?
解决方案
似乎任何第 3 方都在内部使用此支持库依赖项。您可以使用以下 gradle 任务查看依赖关系树:
gradle app:dependencies
它将打印所有直接依赖项以及您包含的任何 1st/2nd/3rd 方库声明的依赖项。
然后你可以做这样的事情来从你的树中排除这个依赖,例如,如果 play-services 是罪魁祸首,那么你可以做这样的事情:
compile('com.google.android.gms:play-services-base:6.5.1'){
exclude module: 'support-v4'
}
推荐阅读
- kubernetes - az aks update-credentials - 如何忽略未找到资源错误
- php - PHP file_get_contents 的问题
- javascript - 为什么`
` 当我使用 this.state.reachedBottom 时消失? - reactjs - 如何覆盖样式组件中的 React Slick 类?
- python - 不被识别为内部或外部命令、可运行程序或批处理文件
- javascript - 我如何自动填充 angularjs 输入
- sorting - Unity - 对来自同一预制件的对象进行排序层
- powershell - 我可以在 powershell 读取主机中使用现有变量吗
- javascript - 函数返回待处理的 Promise 而不是布尔值
- django - 将模型实例集与其在 DB 中的对应部分进行比较 | 姜戈