Error when publish to Google play and add to library to gradle

Viewed 288

I want to publish my app to Google PLay Error : "We found that the application uses the old version of the Google Play Developer API. From December 1, 2019, support for versions 1 and 2 of this API will cease. Update it to version 3 before this date. Read more ..." I found, how to fix it, I need to gradle this library

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

But when I build APK, studio show me error

<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>

what am I doing wrong ?

2 Answers

Add this to project gradle

repositories {
    mavenCentral()
}

Below code to your app gradle

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

Add this...

android {
...

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