OneDrive / onedrive-sdk-android

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

Android OneDrive No virtual method acquireToken #140

Closed TerZer closed 1 month ago

TerZer commented 6 years ago

On OneDrive API client creation it gives me this error:

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 class looks like this:

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);
    }

I went trought internet to find the solution for this, but I didn't found it.. Sorry for bad English, not native language.

EmmanuelMess commented 4 years ago

Check your dependency versions to coincide with these ones:

https://github.com/OneDrive/onedrive-sdk-android/blob/1af2f0e788b180e91c6b0d4c52d87d4e11c07334/onedrivesdk/build.gradle#L63-L73

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