OneDrive / onedrive-sdk-android

OneDrive SDK for Android!
https://dev.onedrive.com
Other
148 stars 52 forks source link

java.lang.IncompatibleClassChangeError #146

Closed AlexMofer closed 1 month ago

AlexMofer commented 5 years ago
java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:354)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.IncompatibleClassChangeError: Class 'org.apache.http.conn.ssl.SSLSocketFactory' does not implement interface 'org.apache.http.conn.scheme.SchemeSocketFactory' in call to 'java.net.Socket org.apache.http.conn.scheme.SchemeSocketFactory.createSocket(org.apache.http.params.HttpParams)' (declaration of 'org.apache.http.impl.conn.DefaultClientConnectionOperator' appears in /data/app/com.wondershare.pdfelement-iS3XRaulaPRzkPl7zrV3Sg==/split_lib_dependencies_apk.apk!classes2.dex)
        at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:168)
        at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:326)
        at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
        at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
        at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
        at com.microsoft.services.msa.TokenRequest.execute(TokenRequest.java:104)
        at com.microsoft.services.msa.TokenRequestAsync.doInBackground(TokenRequestAsync.java:68)
        at com.microsoft.services.msa.TokenRequestAsync.doInBackground(TokenRequestAsync.java:31)
        at android.os.AsyncTask$2.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 

触发条件: targetSdkVersion 28 api 28 在完成登录的最后一步时报出。

初步猜测原因: 使用在API 22上就已经Deprecated的SSLSocketFactory,在程序设置targetSdkVersion 28时,在api 28(Android 9)必然触发。

适配API 28是必然,期望早日解决。非常感谢!

AlexMofer commented 5 years ago

使用版本:

implementation 'com.microsoft.services.msa:msa-auth:0.8.6'
implementation 'com.onedrive.sdk:onedrive-sdk-android:1.3.1'
AlexMofer commented 5 years ago

在AndroidManifest的application标签下增加:

<uses-library
            android:name="org.apache.http.legacy"
            android:required="false" />

可解决该问题。但这并非最佳方案。 貌似该sdk已被废弃不维护了,官方主推他们的新的Graph SDK。 但他们的Graph库需配合他们的账户授权库,而账户授权库2.x版本又跟Google Play services存在冲突问题,且其最低API尽然要去到21。这又是另外的坑了。

baywet commented 1 month ago

Thank you for reaching out and for your patience. This SDK is being officially deprecated. See #172 for more information