Skip to content

Cannot resolve anything in com.dropbox.core.android #481

Description

@schdief06

I'm currentliy integrating Dropbox into my app. I started with the desktop version, which worked flawlessly.

But now on Android I'm having problem to set everything up. I wanted to use the OAuth flow using the Dropbox app to authenticate. But all the content of com.dropbox.core.android seems to be missing. So e.g. th class com.dropbox.core.android.Auth cannot be resolved. Same for the AuthActivity.

I just added the Dropbox (and kotlin as I wasn't using it before) dependency to my build.gradle and synced gradle:

    implementation 'com.dropbox.core:dropbox-core-sdk:5.4.4'
    implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.7.20'

All the other classes are there, just the content of android isn't.

Am I missing something? There is just this library? No dedicated Android library, right?
Thanks for helping!

Activity

  1. schdief06 commented on Nov 29, 2022

    @schdief06
    Author

    For now I will be using the web authentication as I'm doing on desktop:

            DbxRequestConfig dropboxRequestConfig = new DbxRequestConfig("text-edit/0.1");
            DbxAppInfo appInfo = new DbxAppInfo(APP_KEY, APP_SECRET);
            dropboxAuth = new DbxWebAuth(dropboxRequestConfig, appInfo);
    
            DbxWebAuth.Request authRequest = DbxWebAuth.newRequestBuilder()
                    .withNoRedirect()
                    .withTokenAccessType(TokenAccessType.OFFLINE)
                    .build();
            String authorizeUrl = dropboxAuth.authorize(authRequest);
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(authorizeUrl));
            startActivity(browserIntent);
    

    But I'd really like to check out the authentication via dropbox app

  2. handstandsam commented on Nov 30, 2022

    @handstandsam
    Contributor

    It looks like your configuration is correct including what you specified for the implementation dependencies.

    Do you have the Kotlin Android plugin configured for your application? That is also required, and can be added like this:

    id 'org.jetbrains.kotlin.android'


    Can you check out our working Android example here:

    https://github.com/dropbox/dropbox-sdk-java/tree/main/examples/android

    I just updated the README file associated with that example here: https://github.com/dropbox/dropbox-sdk-java/blob/main/examples/android/ReadMe.md


    This is the code that triggers user authentication in the Android Application:

    /**
    * Starts the Dropbox OAuth process by launching the Dropbox official app or web
    * browser if dropbox official app is not available. In browser flow, normally user needs to
    * sign in.
    *
    * Because mobile apps need to keep Dropbox secrets in their binaries we need to use PKCE.
    * Read more about this here: https://dropbox.tech/developers/pkce--what-and-why-
    **/
    fun startDropboxAuthorization2PKCE(context: Context) {
    val requestConfig = DbxRequestConfig(dropboxAppConfig.clientIdentifier)
    // The scope's your app will need from Dropbox
    // Read more about Scopes here: https://developers.dropbox.com/oauth-guide#dropbox-api-permissions
    val scopes = listOf(
    "account_info.read",
    "files.content.write",
    "files.content.read",
    "sharing.read"
    )
    Auth.startOAuth2PKCE(context, dropboxAppConfig.apiKey, requestConfig, scopes)
    isAwaitingResult = true
    }
    /**
    * Starts the Dropbox OAuth process by launching the Dropbox official app or web
    * browser if dropbox official app is not available. In browser flow, normally user needs to
    * sign in.
    *
    * Because mobile apps need to keep Dropbox secrets in their binaries we need to use PKCE.
    * Read more about this here: https://dropbox.tech/developers/pkce--what-and-why-
    **/
    fun startDropboxAuthorizationOAuth2(context: Context) {
    Auth.startOAuth2Authentication(context, dropboxAppConfig.apiKey)
    isAwaitingResult = true
    }

    I hope this helps!

  3. handstandsam commented on Feb 3, 2023

    @handstandsam
    Contributor

    @schdief06 did that solve your issue? If so, we can close this ticket.

  4. jamesncl commented on Jun 12, 2024

    @jamesncl

    If you're using version 6.0.0 or later you are probably missing the additional dropbox-android-sdk dependency from your gradle which is now required for the Android specific parts of the SDK, because they have been split out into a separate library:

    implementation 'com.dropbox.core:dropbox-core-sdk:7.0.0'
    implementation 'com.dropbox.core:dropbox-android-sdk:7.0.0'
    

    See the docs on Android usage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions