Closed BlackFish768 closed 1 year ago
Hi, It appears you are using Gradle plugin 4.4 or above, could you please confirm? Could you please try adding the below line to the build.gradle file under the android tag? useLibrary 'org.apache.http.legacy' or add the below implementation under the dependency? implementation 'net.sourceforge.htmlunit:htmlunit:2.15' and let us know if it works.
An year later. Still stuck on same error. I tried alot of things but nothing worked. It seems the problem is with 'b2-sdk-httpclient' even the android studio is giving a warning " httpclient defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar."
I gave up on this SDK a year ago I used the native API back then. Now it seems that you guys have removed that and we have no option but to use the provided SDK but I'm unable to do anything! Please help me. I added the 'implementation 'net.sourceforge.htmlunit:htmlunit:2.15'' as well but still getting the same error.
And yes, I'm using a newer version of gradle, Gradle Version: 7.4, Gradle Plugin Version: 7.3.1
Hi, it seems this library is not meant for Android XD. Guess I will move to AWS then.
Here is the code I used to create B2StorageClient
B2StorageClient client = B2StorageClientFactory .createDefaultFactory() .create(APP_KEY_ID, APP_KEY, USER_AGENT);
I get this fatal exeption ->
java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar!classes5.dex) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:151) at com.backblaze.b2.client.webApiHttpClient.HttpClientFactoryImpl$Builder.createConnectionManager(HttpClientFactoryImpl.java:196) at com.backblaze.b2.client.webApiHttpClient.HttpClientFactoryImpl$Builder.build(HttpClientFactoryImpl.java:160) at com.backblaze.b2.client.webApiHttpClient.HttpClientFactoryImpl.build(HttpClientFactoryImpl.java:66) at com.backblaze.b2.client.webApiHttpClient.B2WebApiHttpClientImpl.<init>(B2WebApiHttpClientImpl.java:58) at com.backblaze.b2.client.webApiHttpClient.B2WebApiHttpClientImpl.<init>(B2WebApiHttpClientImpl.java:49) at com.backblaze.b2.client.webApiHttpClient.B2WebApiHttpClientImpl$Builder.build(B2WebApiHttpClientImpl.java:375) at com.backblaze.b2.client.webApiHttpClient.B2StorageHttpClientBuilder.build(B2StorageHttpClientBuilder.java:68) at com.backblaze.b2.client.webApiHttpClient.B2StorageHttpClientFactory.create(B2StorageHttpClientFactory.java:21) at com.backblaze.b2.client.B2StorageClientFactoryPathBasedImpl.create(B2StorageClientFactoryPathBasedImpl.java:69) at com.backblaze.b2.client.B2StorageClientFactory.create(B2StorageClientFactory.java:44)
At first I was getting execution failed for using B2HTTPS dependency i.e 'com.backblaze.b2:b2-sdk-httpclient:5.0.0' error message was ->
2 files found with path 'META-INF/DEPENDENCIES'. Adding a packagingOptions block may help, please refer to https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html for more information
I fixed it by adding this in Gradle -> Android { }
packagingOptions { exclude 'META-INF/DEPENDENCIES' }
But now I am getting No static field instance error(mentioned above). Please help!