Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropbox login crash on Android 13 with targetSdk 33 #406

Closed
DynamicG-Android opened this issue Aug 1, 2022 · 12 comments
Closed

Dropbox login crash on Android 13 with targetSdk 33 #406

DynamicG-Android opened this issue Aug 1, 2022 · 12 comments
Assignees
Labels

Comments

@DynamicG-Android
Copy link

Hi,
I've lifted my app to targetSdk 33. The Dropbox login flow crashes on my Android 13 device when pressing "Allow" in the "grant access" dialog in the Dropbox app (i.e. throwing ActivityNotFound when trying to call back to my app). Very likely root cause: "Intent filters block non-matching intents" change introduced with Android 13 SDK 33. It works fine when reverting my app to targetSdk 31.

Are you aware of this issue? I assume this needs a patch on your side (?)

Stack trace:

Process: [com.dropbox.android](http://com.dropbox.android/)
    android.content.ActivityNotFoundException: Unable to find explicit activity class {com.myapp.MyActivity/com.dropbox.core.android.AuthActivity}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared <intent-filter>?
        at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2158)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1805)
        at android.app.Activity.startActivityForResult(Activity.java:5470)
        at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:2)
        at android.app.Activity.startActivityForResult(Activity.java:5428)
        at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:1)
        at android.app.Activity.startActivity(Activity.java:5926)
        at android.app.Activity.startActivity(Activity.java:5893)
        at dbxyzptlk.Wd.a.b(RealSafeIntentStarter.java:3)
        at com.dropbox.android.dauth.DelegatedAuthActivity$j$c.a(DelegatedAuthActivity.java:9)
        at com.dropbox.android.dauth.DelegatedAuthActivity$j.a(DelegatedAuthActivity.java:2)
        at dbxyzptlk.Vg.c.onPostExecute(DbxAsyncTask.java:10)
        at android.os.AsyncTask.finish(AsyncTask.java:771)
        at android.os.AsyncTask.-$$Nest$mfinish(Unknown Source:0)
        at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7898)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

@greg-db
Copy link
Contributor

greg-db commented Aug 1, 2022

Thanks for the report! We'll look into it.

@devPalacio
Copy link
Contributor

Hey @DynamicG-Android, could you show me what your manifest looks like?

Are you using the com.dropbox.core.android.AuthActivity like the example app?

I got it working on the example app by adding the following intent filter under the AuthActivity

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

Let me know if that helps.

@DynamicG-Android
Copy link
Author

perfect. yes this works. many thanks. (and yes, my manifest entry is like in the example app).

recap for those stumbling over the same problem and seeing this - the second intent-filter needs to be added to manifest when targeting Android 13:

        <activity
            android:name="com.dropbox.core.android.AuthActivity"
            android:exported="true"
            android:configChanges="orientation|keyboard"
            android:launchMode="singleTask">
            <intent-filter>
                <!-- Change this to be db- followed by your app key -->
                <data android:scheme="db-${dropboxKey}" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <!-- for Android 13 -->
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

@devPalacio
Copy link
Contributor

@DynamicG-Android We're exploring other options to not require that extra intent-filter but those will depend on an update to the Dropbox App which might take some time

@devPalacio devPalacio self-assigned this Aug 15, 2022
@devPalacio devPalacio added the bug label Aug 15, 2022
@devPalacio
Copy link
Contributor

devPalacio commented Sep 23, 2022

Fixed. We've shipped some changes in our Dropbox application and the extra intent filter is no longer required. Feel free to remove it from your manifest.

I just tested this flow with no extra intent filter on Dropbox 298.2.2 and our example app that's being released with 5.4.2 shortly

@hubercode
Copy link

@devPalacio thank you for fixing this. I assume it is save to leave the intent filter for users which haven't upgraded their dropbox app yet, right?

@devPalacio
Copy link
Contributor

Yes, this is a valid as a workaround until you're confident your users are running a newer version of Dropbox.

@handstandsam
Copy link
Contributor

FYI: This version @devPalacio mentions v298.2.2 with the fix is available to all users starting September 20, 2022.

@devPalacio
Copy link
Contributor

We made a mistake when testing our sdk integration with the Dropbox app. Unfortunately the crash still exists with the latest version Dropbox. Please continue to use the extra intent filter until we come up with a better solution.

@handstandsam
Copy link
Contributor

We've determined a fix from the Dropbox app side for this issue. We needed to explicitly add in the data field to the Intent and add the android.intent.category.BROWSABLE starting with this change in Android 13.

I'm going to re-open this issue until the fix in the Dropbox application is widely available.

WORKAROUND: This issue can be avoided using the answer above #406 (comment)

@handstandsam
Copy link
Contributor

This PR updates the Sample app with this workaround when targeting SDK 33. https://github.com/dropbox/dropbox-sdk-java/pull/472/files

@greg-db
Copy link
Contributor

greg-db commented Nov 14, 2022

The fix should be fully released now. Please let us know if you're still seeing any issues with the latest SDK/app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants