java - 需要帮助,我是 Android Studio 的初学者

标签 java android

我收到了继续 Android Studio 项目的任务,但是当我发布 APK 时出现了这样的错误。

../../build.gradle: commons-logging 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.

../../build.gradle: httpclient 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 jar.

这在我的 build.gradle 依赖项中

 dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.google.code.gson:gson:2.4'
    compile 'org.apache.httpcomponents:httpcore:4.2.4'
    compile 'org.apache.httpcomponents:httpmime:4.3'
    compile 'com.android.support:appcompat-v7:28.0.0'
    compile 'com.android.support:support-compat:28.0.0'
    compile 'com.android.support:design:28.0.0'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
    compile 'com.android.support:support-v4:28.0.0'
    compile 'com.google.code.gson:gson:2.4'
    compile 'com.google.zxing:core:3.2.1'
    compile 'com.google.android.gms:play-services-maps:11.0.4'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:cardview-v7:28.0.0'
    compile 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
    compile 'me.dm7.barcodescanner:zxing:1.9'
    compile 'com.google.firebase:firebase-messaging:11.0.4'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

但我不知道问题出在哪里..

最佳答案

将此添加到应用程序模块中的 build.gradle

configurations {
    all {
        exclude module: 'httpclient'
    }
}

希望能成功

谢谢!快乐编码!

关于java - 需要帮助,我是 Android Studio 的初学者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61606291/

相关文章:

java - 大小为 0 的 CursorIndexOutOfBoundsException : Index 0 requested,

java - 从扩展类中覆盖 compareTo - 发生了什么?

java - 摩基托 : How to Verify that a parameter is an Object with a specific parameter?

java - 在 Java Web 服务中生成的客户端工件

android - 如何选择带有 ACTION_SENDTO 的电子邮件应用程序也支持附件?

java - 尝试录制音频时应用程序崩溃

android - 是否有适用于 Android 的免费 OCR 库?

android - 如何获取在资源管理器中打开android手机后显示的android文件夹的路径?

java - 来自多个集合的组合算法

java - JScrollPane 内的 JEditorPane 未根据需要调整大小