No Such Field Error when using jReddit

109 Views Asked by At

When trying to run an app that uses the jReddit library, a No Such Field Error is thrown: java.lang.NoSuchFieldError: org.apache.http.message.BasicLineFormatter.INSTANCE

Looking at other SO issues, it seems that renaming the http-core library would fix this, but as I am relatively new at java, and don't want to edit the jreddit jar for fear of it breaking, I cannot follow the advice given.

1

There are 1 best solutions below

0
On

Disclaimer: I am the current maintainer for jreddit project

Can you try adding these dependencies in your project?

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, you check another question that I've answered here