lookfirst/sardine

Error on HTTPS-Connection (NoSuchFieldError)

Opened this issue · 2 comments

Hi,

I get a Fatal Exception on runtime. The error is

08-22 09:56:33.570 8228-8228/com.mydomain.dav.app E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.mydomain.myapp.app, PID: 8228
    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!classes3.dex)
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:144)
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.getSocketFactory(SSLConnectionSocketFactory.java:172)
        at com.github.sardine.impl.SardineImpl.createDefaultSecureSocketFactory(SardineImpl.java:1132)
        at com.github.sardine.impl.SardineImpl.createDefaultSchemeRegistry(SardineImpl.java:1115)
        at com.github.sardine.impl.SardineImpl.configure(SardineImpl.java:1080)
        at com.github.sardine.impl.SardineImpl.<init>(SardineImpl.java:207)
        at com.github.sardine.SardineFactory.begin(SardineFactory.java:44)
        at com.github.sardine.SardineFactory.begin(SardineFactory.java:34)
        at com.mydomain.myapp.app.MainActivity.test(MainActivity.java:30)
        at com.mydomain.myapp.app.MainActivity.onCreate(MainActivity.java:22)
        at android.app.Activity.performCreate(Activity.java:7136)
        at android.app.Activity.performCreate(Activity.java:7127)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

This is my code:

public void test() throws Exception
{
  Sardine sardine = SardineFactory.begin("test@test.de", "test");
  List<DavResource> resources = sardine.list("https://cloud.mydomain.com/dav/Test/");

  for (DavResource res : resources)
  {
    System.out.println(res);
  }
}

My build.gradle dependencies:

implementation 'com.github.lookfirst:sardine:5.8'

Has anybody an idea, what I'm doing wrong? Please let me know if you need any information.

Thank you so much!

I have same problem, how to resolve this?