java.lang.NoSuchMethodError org.apache.http.client.entity.UrlEncodedFormEntity.<init> in Android Studio

912 Views Asked by At

I'm making a Reddit app using the jReddit wrapper and I'm having trouble with the apache http client throwing the above exception. My dependencies look like this:

dependencies

and my libraries look like this:

libs

I have seen other questions on SO regarding similar exceptions, with people saying they may have two of the same jars in their classpath, but I am yet to find an answer which provides me with a solution of how to check for or eliminate duplicate/deprecated jars. Does anyone know how to solve this? Any help greatly appreciated, thanks.

1

There are 1 best solutions below

0
On

Disclaimer: I am the current maintainer for jReddit project.

We recently released a new version of the jreddit library, which is 1.0.3.

Can you try changing your dependencies to this?

dependencies {
    compile('com.github.jreddit:jreddit:1.0.3') {
        exclude group: 'org.apache.httpcomponents', module: 'httpclient'
        exclude module: 'junit'
    }
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
    compile 'com.android.support:appcompat-v7:22.0.0'
}

Also, I've explained in another question regarding an android example. Check out this guy