简体   繁体   中英

Android : issue when using Dropbox SDK - Dropbox Chooser requires Fragments

am trying to use the Dropbox Chooser API in my Android App. I have followed the steps outlined in the Dropbox documentation ( https://www.dropbox.com/developers/dropins/chooser/android ). But am getting this exception:

java.lang.IllegalArgumentException: Dropbox Chooser requires Fragments. If below API level 11, pass in a FragmentActivity from the support library.

But am not using Fragments. What does it mean by "pass a FragmentActivity"? Where should I pass it? Any link to sample code will help.

it seems that you have to use fragments, to be able to use the Dropbox Choser API.

at the bottom of the document you linked, they even mention your error message.

The Android Chooser SDK includes the Android Support Library and is written to support Android API version 8 and higher. To support Android API versions 8, 9, and 10, your app must extend Activity or android.support.v4.app.FragmentActivity instead of Fragment . If it doesn't, you'll see the following error in LogCat when using the Android Chooser on these older versions:

The Chooser requires Fragments. If below API level 11, pass in a FragmentActivity from the support library.

Also, the Android Support Library that is bundled with the Chooser may conflict with the support library in your project if your project has a different version. If you see a "Jar mismatch! Fix your dependencies" error in the Console, delete android-support-v4.jar in the libs directory of DropboxChooserSDK and copy the version of android-support-v4.jar from your project into that folder.

you should consider start using fragments. at least for the portion of code where you want to use dropbox. here you find a guide about fragments and how to getting started with them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM