0

My app was working fine . Today i have change some internal things and update my app . In release Apk i am getting this error :

Class 'org.apache.http.message.BufferedHeader' does not implement interface 'org.apache.http.NameValuePair'

My app was working fine in previous updates . I am not getting what is the problem . I am using pro-guard and also added rules properly. What is the main reason of this error. I have checked all answer of this particular error on stackoverflow.

Also Added this to build.gradle :

android {
        useLibrary 'org.apache.http.legacy'
    }

In Manifest:

 <uses-library
        android:name="org.apache.http.legacy"
        android:required="false" />

Proguard:

-keep class org.apache.http.** { *; }
-keep class org.apache.** { *; }
-dontwarn org.apache.**
-dontwarn org.apache.http.**
-dontwarn org.apache.commons.**
-keep class com.google.api.** { *; }
-keepattributes Annotation

1 Answer 1

1

Assuming that org.apache.http.message.BufferedHeader is a legitimate implementation of the interface org.apache.http.NameValuePair, you have duplicate classes on the classpath - look out specifically for two distinct occurrences of NameValuePair.

The error message omits the classloader or home jar file: Think of it as:

Class 'org.apache.http.message.BufferedHeader' does not implement interface 'org.apache.http.NameValuePair' from jar X, while it implements an interface with the same name from jar Y.

Identify what you did during the time that you describe as "change some internal things and update my app", it might point you to it. If you didn't introduce another dependency, the class loading order might have changed.

If that doesn't help: Look through the runtime classpath and identify the jars that introduce the same class files. Eliminate duplications.

Sign up to request clarification or add additional context in comments.

2 Comments

Implement implementation 'com.revenuecat.purchases:purchases:3.1.0' to my app for in app purchase.App works in debugging . But fails in release apk. Can you please help me to solve this? How to find duplicates ?
Sorry, you'll have to look at whatever is available at runtime yourself. If the apk is self-contained, it might help to unpack everything in there individually, while observing warnings for overwrites of existing files (if you unpack all of the contained jars in the same locaion). Also, make sure that the runtime doesn't add any global classes (or include them in your analysis). Or just inspect all of the release classes for duplicate occurrences of NameValuePair (but this might miss other duplications). Either way, you'll have to do the search yourself, sorry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.