Android OneDrive没有虚拟方法acquireToken

时间:2018-06-11 20:47:03

标签: android onedrive

在创建OneDrive API客户端时,它会出现此错误:

E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1
                  Process: terzer.lt.drivesapplication, PID: 14982
                  java.lang.NoSuchMethodError: No virtual method acquireToken(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/microsoft/aad/adal/PromptBehavior;Ljava/lang/String;Lcom/microsoft/aad/adal/AuthenticationCallback;)V in class Lcom/microsoft/aad/adal/AuthenticationContext; or its super classes (declaration of 'com.microsoft.aad.adal.AuthenticationContext' appears in /data/app/terzer.lt.drivesapplication-1/base.apk:classes2.dex)
                      at com.onedrive.sdk.authentication.ADALAuthenticator.getDiscoveryServiceAuthResult(ADALAuthenticator.java:556)
                      at com.onedrive.sdk.authentication.ADALAuthenticator.login(ADALAuthenticator.java:289)
                      at com.onedrive.sdk.extensions.OneDriveClient$Builder.loginAndBuildClient(OneDriveClient.java:172)
                      at com.onedrive.sdk.extensions.OneDriveClient$Builder.access$500(OneDriveClient.java:64)
                      at com.onedrive.sdk.extensions.OneDriveClient$Builder$1.run(OneDriveClient.java:147)
                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                      at java.lang.Thread.run(Thread.java:818)

One Drive类看起来像这样:

public class OneDrive {

    private IOneDriveClient client;

    final ADALAuthenticator adalAuthenticator = new ADALAuthenticator() {
        @Override
        public String getClientId() {
            return "nothing to see here";
        }

        @Override
        protected String getRedirectUrl() {
            return "https://localhost";
        }
    };

    public OneDrive() {
        final IClientConfig oneDriveConfig = DefaultClientConfig.createWithAuthenticator(adalAuthenticator);

        final ICallback<IOneDriveClient> callback = new ICallback<IOneDriveClient>() {
            @Override
            public void success(final IOneDriveClient result) {
                client = result;
            }

            @Override
            public void failure(final ClientException error) {
               client = null;
            }
        };

        new OneDriveClient.Builder().fromConfig(oneDriveConfig).loginAndBuildClient(MainActivity.getInstance(),  callback);
    }

我去网上寻找解决方案,但我没有找到它。 对不起英语不好,不是母语。

更新:所以我发现更深入,发现在SDK本身中找不到这种身份验证方法,但问题是这种方法存在于那里,所以我真的不知道该怎么做..

0 个答案:

没有答案