1

Firstly I have used all of the solution in stackoverflow but in release apk i am getting this error. Can anyone tell me how to solve the issue? I am facing this problem while getting time from google.

dateStr = response.getFirstHeader("Date").getValue();

I also added Volly Lib And this on manifest. The method is working in my other apps , But i don't know why it is happening in a particular app.

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

Exception:

Caused by: java.lang.IncompatibleClassChangeError: Class 'org.apache.http.message.BufferedHeader' does not implement interface 'org.apache.http.NameValuePair' in call to 'java.lang.String org.apache.http.NameValuePair.getValue()' (declaration of 'package.MainActivity$GoogleTime' appears in /data/app/packagename-666QBWSxEt_A-vBNzTMWfA==/base.apk)
1

2 Answers 2

2
+50

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

Comments

0

Have you ever tried to add this to your grade file

useLibrary 'org.apache.http.legacy'

like this

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

dependicies {
.
.
}

2 Comments

Hmm, have you check that answer as well? stackoverflow.com/questions/56665050/…
Everything was fine. I just change a small line in the app and update my app. When i download my app from play store it's crashing .

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.