相关疑难解决方法(0)

commons-logging定义了与Android Studio Update之后Android现在提供的类冲突的类

我已将Android Studio更新为版本3,现在似乎无法编译我之前编译的项目而没有错误.

错误消息如下

错误:错误: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'
}
Run Code Online (Sandbox Code Playgroud)

和错误似乎是由

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'
Run Code Online (Sandbox Code Playgroud)

我已经使用了exclude module: 'httpclient' 为什么它不编译?这是Android Studio 3和\或包含com.android.tools.build:gradle:3.0.0插件的错误还是我遗漏了什么?使用以前的版本编译完全相同的项目没有问题.

android android-studio android-gradle-plugin android-studio-3.0 android-gradle-3.0

47
推荐指数
5
解决办法
2万
查看次数

在Room persistence上构建版本时,错误[DuplicatePlatformClasses]类发生冲突

我已经使用本指南在我的Android应用程序中使用Room构建持久性:https: //developer.android.com/training/data-storage/room/index.html

并添加了如下所示的依赖:https: //developer.android.com/topic/libraries/architecture/adding-components.html

当我构建调试版本和沉默到手机,everithing工作正常.

当我构建发布签名APK时,我收到此错误消息:

Error:Error: json defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses]
Run Code Online (Sandbox Code Playgroud)

我的app.gradle:

apply plugin: 'com.android.application'

android {
    signingConfigs {
        /* TODO(developer): Configure to sign app with a release key for testing.
        release {
            storeFile file('path/to/release/signing/key')
            keyAlias 'release_key_alias' …
Run Code Online (Sandbox Code Playgroud)

android gradle android-manifest android-gradle-plugin android-room

4
推荐指数
1
解决办法
2171
查看次数