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)
Nasirure
  • 11
  • 2
  • https://stackoverflow.com/questions/54414287/using-org-apache-http-legacy-in-android-9/54414655 Check if this question can be any kind of help to you – Ruben Meiring Oct 01 '19 at 07:31

2 Answers2

2

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.

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 {
.
.
}
haliltprkk
  • 1,428
  • 3
  • 14
  • 26
  • Hmm, have you check that answer as well? https://stackoverflow.com/questions/56665050/java-lang-incompatibleclasschangeerror-class-org-apache-http-message-basichead – haliltprkk Apr 15 '20 at 10:02
  • 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 . – Muntasir Aonik Apr 15 '20 at 10:11