javaandroidpinterestpdk

Error on integrating pdk (pinterest sdk )


I wanted to integrate pinterest to share a link on pinterest. for that, I downloaded pdk from the official document.

But when I tried to run the app, I faced some compilation errors for following classes org.apache.http.NameValuePair and org.apache.http.client.utils.URLEncodedUtils . but, After that, I faced some proguard issues and I added the required statements.

Most of the errors are solved by adding the following lines into pdk module's proguard-rules.pro file.

-libraryjars libs\android-support-v4.jar
-libraryjars <java.home>\lib\rt.jar

-dontwarn org.apache.commons.**

-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**

-dontwarn org.codehaus.jackson.**
-keep class org.codehaus.jackson.** { *; }

But, still I am facing some issues for these warnings:

library class com.fasterxml.jackson.core.util.DefaultPrettyPrinter$Lf2SpacesIndenter extends or implements program class com.fasterxml.jackson.core.util.DefaultPrettyPrinter$NopIndenter

com.fasterxml.jackson.databind.util.TokenBuffer$Parser: can't find referenced method 'com.fasterxml.jackson.core.json.JsonReadContext createRootContext(int,int)' in program class com.fasterxml.jackson.core.json.JsonReadContext

there were 1 instances of library classes depending on program classes.

there were 1 unresolved references to program class members.

Exception while processing task java.io.IOException: Please correct the above warnings first.

Do anyone has any idea how to solve this?

build.gradle file of pdk module

apply plugin: 'com.android.library'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"

    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.mcxiaoke.volley:library:1.0.19'

//    implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'

    implementation 'com.google.http-client:google-http-client-android:1.25.0'
    implementation 'com.google.api-client:google-api-client-android:1.25.0'
    implementation 'com.google.api-client:google-api-client-gson:1.25.0'

}

Please help me to solve these errors Thank you.


Solution

  • I solved the error by adding these lines in proguard

    -dontwarn com.fasterxml.jackson.**
    -keep class com.fasterxml.jackson.** { *;}