我更新到gradle 4.0.1并开始收到以下错误
图书馆com.google.android.gms:play-services-measurement-base正在[[15.0.4,15.0.4]]的各个其他图书馆请求,但已解析为15.0.2.禁用插件并使用./gradlew:app:dependencies检查依赖关系树.
我的项目没有使用那种依赖,所以我在全球范围内搜索它,它只出现在里面
建立/中间体/棉绒的高速缓存/ maven.google/COM /谷歌/机器人/克/基INDEX.XML
就像这一行
__CODE__
所以我尝试删除我的构建文件夹并清理项目,但它使用相同的值重新生成它:/因此错误仍然存在
根据这个 SO线程,我知道存在版本冲突,但是在谷歌的新版本之后问题仍然存在.
错误:任务':app:processDebugGoogleServices'的执行失败.请通过更新google-services插件的版本来修复版本冲突(有关最新版本的信息,请访问https://bintray.com/android/android-tools/com.google.gms.google-services/)或将com.google.android.gms的版本更新为10.0.1.
我的build.gradle(模块:app)
....
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
现在需要做哪些改变?
android firebase google-play-services firebase-cloud-messaging
在我的Android项目中,我使用了一个jar作为库.我将它包含在依赖项部分中,如下所示:
dependencies {
...
compile files('libs/thethirdpartylibrary.jar')
...
}
Run Code Online (Sandbox Code Playgroud)
我也想使用okhttp库,我包括这样的:
compile ('com.squareup.okhttp:okhttp:2.7.5')
Run Code Online (Sandbox Code Playgroud)
(这个特殊版本的okhttp取决于okio 1.6.0.)
问题是第三方jar库依赖于okio v0.9.0而更糟糕的是捆绑它.
结果,我在构建时遇到了一个dex冲突错误.
我能够通过手动从jar文件中删除okio来解决这个问题,这似乎有效.但我想知道是否有办法在gradle中做到这一点.
我的问题:我可以在构建时使用gradle从包含的jar中删除捆绑的,可传递的(< - 我希望我正确地使用这个词)依赖关系吗?