我已将安卓工作室更新至版本3,但现在似乎无法编译之前已经成功编译的项目。
错误信息如下:
Error:Error: commons-logging 定义了和Android提供的类冲突的类。解决方案包括寻找更新版本或者没有相同问题的替代库(例如,对于httpclient使用HttpUrlConnection或okhttp代替),或者使用jarjar之类的工具重新打包库。 [DuplicatePlatformClasses]
依赖关系为
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:27.0.0'
compile 'com.android.support:design:27.0.0'
compile 'com.google.api-client:google-api-client-android:1.23.0' exclude module: 'httpclient'
compile 'com.google.http-client:google-http-client-gson:1.23.0' exclude module: 'httpclient'
compile 'com.google.firebase:firebase-core:11.4.2'
}
错误似乎是由
引起的compile 'com.google.api-client:google-api-client-android:1.23.0' exclude module: 'httpclient'
compile 'com.google.http-client:google-http-client-gson:1.23.0' exclude module: 'httpclient'
我已经使用exclude module: 'httpclient'
了,为什么它不能编译?这是Android Studio 3和/或包含的com.android.tools.build:gradle:3.0.0
插件的bug还是我漏掉了什么?和之前的版本一样,编译完全相同的项目没有问题。
commons-logging
上。也许有更新的com.google
依赖项版本可供使用。 - CommonsWare