IncompatibleClassChangeError exception is thrown w

2019-07-07 06:59发布

问题:

I'm working on an Android application, which is going to upload some files to Google Cloud Storage. To do this, I'm using JetS3t java toolkit 0.9. I tried to use it on standard Java project and worked fine, but when I want to use it on Android project, I'm getting an exception.

I'm having the problem when instantiating a JetS3t Google Storage Service, like this:

GoogleStorageService gsService = new GoogleStorageService(gsCredentials);

The exception I'm getting when this line is executed is this one:

FATAL EXCEPTION: main
java.lang.IncompatibleClassChangeError: org.apache.http.params.SyncBasicHttpParams
    at org.jets3t.service.utils.RestUtils.createDefaultHttpParams(RestUtils.java:574)
    at org.jets3t.service.utils.RestUtils.initHttpConnection(RestUtils.java:298)
    at org.jets3t.service.impl.rest.httpclient.RestStorageService.initHttpConnection(RestStorageService.java:209)
    at org.jets3t.service.impl.rest.httpclient.RestStorageService.initializeDefaults(RestStorageService.java:166)
    at org.jets3t.service.StorageService.<init>(StorageService.java:125)
    at org.jets3t.service.impl.rest.httpclient.RestStorageService.<init>(RestStorageService.java:153)
    at org.jets3t.service.impl.rest.httpclient.GoogleStorageService.<init>(GoogleStorageService.java:125)
    at org.jets3t.service.impl.rest.httpclient.GoogleStorageService.<init>(GoogleStorageService.java:100)
    at org.jets3t.service.impl.rest.httpclient.GoogleStorageService.<init>(GoogleStorageService.java:78)

Looking at the exception thrown, the final error is exactly at this line:

HttpParams params = new SyncBasicHttpParams();

I've tried a bunch of things I saw on the Internet, like adding httpcore-4.1 and httpclient-4.1 jars to the classpath, but was useless.

Very grateful if someone help me! Thanks!

回答1:

Basically..don't use JetS3t on Android...here's what I found: https://groups.google.com/forum/#!topic/jets3t-users/vCq4pwXSPN8