I have been getting some errors in my logcat that crash my application while trying to execute some unirest requests. I know you have to generate a special unirest jar with all the dependencies but I have had problems with maven and did not do this, instead I have included the dependencies separate in the libs folder. I have narrowed the problem down to this single error below.
Logcat:
java.lang.VerifyError: com/mashape/unirest/http/options/Options
at com.mashape.unirest.http.HttpClientHelper.prepareRequest(HttpClientHelper.java:154)
at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:131)
at com.mashape.unirest.request.BaseRequest.asJson(BaseRequest.java:68)
I understand that the java.lang.verifyerror is caused by a different library given at compile time vs run time. But I don't know how to fix this. Please help, make sure all the dependencies I need is below since I have not used unirest before this.
Build.Gradle:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/unirest-java-1.3.20.jar')
compile files('libs/rebound-0.3.6.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/json-20140107.jar')
compile files('libs/httpmime-4.3.5.jar')
compile files('libs/httpclient-4.3.5.jar')
compile files('libs/httpasyncclient-4.0.2.jar')
compile files('libs/httpcore-4.3.2.jar')
compile files('libs/commons-codec-1.6.jar')
compile files('libs/commons-logging-1.1.3.jar')
}
what my libs folder looks like:
commons-io-2.4.jar
httpcore-4.3.2.jar
httpclient-4.3.5.jar
commons-logging-1.1.3.jar
json-20140107.jar
rebound-0.3.6.jar
unirest-java-1.3.20.jar
commons-codec-1.6.jar
httpmime-4.3.5.jar
httpasyncclient-4.0.2.jar
also included this in the build.gradle because I was getting a duplicate file error while trying to build the gradle file:
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}