如何修复Android 9应用中的NTLMScheme类加载错误

时间:2019-09-09 09:53:32

标签: android android-9.0-pie nextcloud

我正在使用NextCloud Android库https://github.com/nextcloud/android-library 到目前为止,我的Android应用已成功连接到下一台云服务器。但是,在将项目更新为Android 9(API 28)之后,该库由于崩溃而不再起作用 由于未加载类:NTLMScheme

我已经将旧的org.apache.http库包含在项目gradle中

useLibrary 'org.apache.http.legacy'

以及android清单中的

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

在该应用中,我根据此旧版库使用其他云(Google Drive API,Dropbox API等),并且它们可以正常工作,只是nextcloud授权不起作用。

我检查了旧版.jar的内容,并看到类NTLMScheme位于该.jar中,但似乎位于不同的路径。知道如何解决这个问题吗?

D/OwnCloudClient #0: REQUEST PROPFIND /remote.php/webdav/
E/ReadFolderRemoteOperation: Synchronized /: failed
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
    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 android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
        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.NoClassDefFoundError: org.apache.commons.httpclient.auth.NTLMScheme
        at org.apache.commons.httpclient.auth.AuthPolicy.class$(AuthPolicy.java:100)
        at org.apache.commons.httpclient.auth.AuthPolicy.<clinit>(AuthPolicy.java:100)
        at org.apache.commons.httpclient.auth.AuthPolicy.getAuthScheme(Unknown Source:0)
        at org.apache.commons.httpclient.auth.AuthState.setPreemptive(AuthState.java:122)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:162)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
        at com.owncloud.android.lib.common.OwnCloudClient.executeMethod(OwnCloudClient.java:221)
        at com.owncloud.android.lib.resources.files.ReadFolderRemoteOperation.run(ReadFolderRemoteOperation.java:80)
        at com.owncloud.android.lib.common.operations.RemoteOperation.execute(RemoteOperation.java:138)
        at com.modelmakertools.simplemindpro.clouds.nextcloud.NextcloudAuthorizationActivity$AuthTesterTask.doInBackground(NextcloudAuthorizationActivity.java:51)
        at com.modelmakertools.simplemindpro.clouds.nextcloud.NextcloudAuthorizationActivity$AuthTesterTask.doInBackground(NextcloudAuthorizationActivity.java:32)
        at android.os.AsyncTask$2.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) 
        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) 

0 个答案:

没有答案