发布到Google Play并添加到库中时发生错误

时间:2019-07-02 08:08:29

标签: android google-play

我想将我的应用发布到Google PLay 错误:“我们发现该应用程序使用旧版本的Google Play开发者API。从2019年12月1日起,将不再支持此API的版本1和2。请在此日期之前将其更新为版本3。 ”。 我发现了如何解决它,我需要对这个库进行升级

implementation 'com.google.apis:google-api-services-androidpublisher:v3-rev95-1.25.0'

但是当我构建APK时,studio会向我显示错误

<issue
    id="DuplicatePlatformClasses"
    severity="Fatal"
    message="`httpclient` defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don&apos;t have the same problem (for example, for `httpclient` use `HttpUrlConnection` or `okhttp` instead), or repackaging the library using something like `jarjar`."
    category="Correctness"
    priority="8"
    summary="Duplicate Platform Classes"
    explanation="There are a number of libraries that duplicate not just functionality of the Android platform but using the exact same class names as the ones provided in Android -- for example the apache http classes. This can lead to unexpected crashes.&#xA;&#xA;To solve this, you need to either find a newer version of the library which no longer has this problem, or to repackage the library (and all of its dependencies) using something like the `jarjar` tool, or finally, rewriting the code to use different APIs (for example, for http code, consider using `HttpUrlConnection` or a library like `okhttp`).">
    <location
        file="D:\Applications\Radio\app\build.gradle"/>
</issue>

我在做什么错了?

2 个答案:

答案 0 :(得分:0)

将此添加到项目gradle

repositories {
    mavenCentral()
}

在代码下方添加应用

dependencies {
    compile 'com.google.apis:google-api-services-androidpublisher:v3-rev95-1.25.0'
}

答案 1 :(得分:0)

添加此...

android {
...

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
 }
}