Skip to content

Troubleshooting

Miguel Ruivo edited this page May 9, 2020 · 28 revisions

Android

Issue:

I'm using FileType.custom with some extensions (eg. [csv, jpg]) and the file explorer doesn't respect it by allowing me picking other types.

Possible solution:

When custom extensions are passed, those are translated into MIME types, then, an intent is sent to system requesting a file explorer to handle those and let you pick the files with the given restrictions — typically, the native one.

However, some Android OS versions (custom roms) not always have the native file explorer, neither you can't prevent the user to install a 3rd party on its own (such as ES FileExplorer). Those file explorers will mostly be capable to handle the request but not always will (actually, most of times won't) honor the MIME restrictions as they need to implement that feature and there's no way you can play around it. So, there's no warranty that fileExtensions will be respected and when you experience this issue, before reporting, try on an official emulator and see if it still happens.

So, because of that, either the package would have to throw an error when the user picked extensions that aren't suppose to, or, the developer can add this extra protection on their side which seems the more appropriate as you can iterate over the picked files and display a custom alert or similar.


Issue:

If for some reason when picking you receive an error telling that permissions are already being request, picker is already active or similar.

Possible solution:

Lately, there have been reports that projects that were started prior to Android V2 embedded, may need to update some properties in order to seamless support updated plugins.

Referring to EdwynZN answer on flutter permission handler plugin, following the official instructions to upgrade pre 1.12 Android projects, seem to fix.

Basically if your Android project MainActivity.java or kt is using io.flutter.app.FlutterActivity or your AndroidManifest.xml is using io.flutter.app.FlutterActivity or have

<meta-data
    android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
     android:value="true" />

you'll need to update your Flutter project in order to work with the new Android plugin type system.


Issue:

If your project fails building due to dependencies missing. Typically this happens with import androidx.lifecycle.DefaultLifecycleObserver; being not recognized.

Possible solution:

Typically this happens because your project isn't fully supporting Android X. Please make sure you have completely migrated to it, by checking the official instructions or you can just check if the requirements below are met.

  1. On your project's android/app/build.gradle change compileSdkVersion and targetSdkVersion to 28

  2. Go to android/gradle.properties file and add the following lines:

android.useAndroidX=true
android.enableJetifier=true

iOS

Issue:

I can't build for iOS. There are some OBJC symbol errors on Xcode or any other weird errors that prevent build to succeed.

Possible solution:

This is often a dependency resolution issue due to existing caching. If you can't build for iOS, regardless of the plugin's version, do the following. It's recommended that you do this every now and then and it also get rid of a lot of used space on your machine.

  1. On project/ios folder, run pod deintegrate && rm Podfile.lock && pod install
  2. On your project folder, run flutter clean
  3. Clear the Xcode derived that by running rm -rf ~/Library/Developer/Xcode/DerivedData
  4. Open the project with Xcode and also clean by doing Cmd + Shift + K

Issue:

I have an issue while picking multiple files from Photos app (gallery)

Possible solution:

This plugin uses DKImagePickerController as sub-dependency for multi picks on Photos app because ImagePickerController from iOS SDK doesn't allow it. Thus, any issue directly related to it, should be filed on its official repo.

Clone this wiki locally