Closed Shakhboz95 closed 3 years ago
Hi, I need more details on how to replicate this.
chooseZipFile({bool` isUpdate = false, int index}) async {
var result = await FilePicker.platform.pickFiles(
type: FileType.custom, allowedExtensions: ["doc", "xls", "pdf", "zip"]);
if (result != null) {
File file = File(result.files.single.path);
int sizeInBytes = file.lengthSync();
double sizeInMb = sizeInBytes / (1024 * 1024);
print("file name: " + result.files.first.name);
if (sizeInMb > 5) {
ToastUtils.toastErrorGeneral("file size is exceeded", _context);
} else {
if (isUpdate) {
_zipTitle[index] = (result.files.first.name);
_zipChosen[index] = true;
} else {
_zipTitle.add(result.files.first.name);
_zipChosen.add(true);
}
notifyListeners();
}
// file.
} else {
// User canceled the picker
}
}
Here is the code. The logic is Users can pick another file if they need after one file.
I got same message on Android & file_picker: 2.1.7. But may be not same way of this issue. I called pickFiles and disallow permission and pickFiles again.
Does the issue applies to iOS or Android?
Unfortunately, I dont have any info about this issue on IOS, I tested it only on android platform, 3 devices displayed this error
Facing the same issue in file_picker: 2.1.7. Using the demo app, it seems like, just on the release version, the Future,
(await FilePicker.platform.pickFiles( type: _pickingType, allowMultiple: _multiPick, allowedExtensions: (_extension?.isNotEmpty ?? false) ? _extension?.replaceAll(' ', '').split(',') : null, ))
does not complete and the Circular Progress Indicator keeps spinning.
This does not happen in debug. Only on release and build apk.
My device is the Samsung S10 lite, API 30. flutter version 2.0.5.
Ok, thank you for the input. I’ll have to replicate it on release, might be related.
I am experiencing the same problem also on debug builds, it seems like the FilePicker.platform.pickFiles()
future never completes..
Edit: I noticed I was overriding onActivityResult(...)
but I wasn't calling super.onActivityResult(...)
, that was my fix; hope it helps anyone even if I highly doubt it, given this issue seems to be different from my original problem.
It is still not working, when I install app for first time.
@Pato05 this is one of those issues that some have it some don't and without easy way to replicate it, hence, this make me believe that could be user-implementation related — like it happened to you.
Closing since this likely is related to the app's implementation that is requesting multiple pickers before closing the previous one.
I am getting same issue on Android Platform after adding some native code for android side.
While compiling project from android side I got this error "The option setting 'android.enableR8=true' is deprecated. It will be removed in version 5.0 of the Android Gradle plugin. You will no longer be able to disable R8 Affected Modules: file_picker"
Solutions that I have already tried 1) downgraded gradle to '3.5.1' 2) upgraded gradle to '7.0.2' (latest) 3) flutter clean & flutter pug get 4) added supper.onActivityResult in onActivityResult function of MainActivity
But none did work.
Currently I am using gradle '4.1.0' with dist 'gradle-6.7-all.zip' and kotlin version = '1.6.0-M1'
Here is flutter doctor result [√] Flutter (Channel stable, 2.5.1, on Microsoft Windows [Version 10.0.19043.1237], locale en-PK) [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [√] Chrome - develop for the web [√] Android Studio (version 2020.3) [!] Android Studio (version 4.1) X Unable to determine bundled Java version. [√] VS Code (version 1.59.1) [√] Connected device (3 available)
! Doctor found issues in 1 category.
You can replicate this on iOS by having allowCompression: true
, then pick a large file (the file i picked was hevc encoded). While this process is running, call the FilePicker.platform.pickFiles
method again, and this time the error will be thrown:
I/flutter (25833): [MethodChannelFilePicker] Platform exception: PlatformException(already_active, File picker is already active, null, null)
Problem is still there and happens lot of times
The issue already happened many times to me.... not ended yet.
Sometimes picking files will not work. I don't know when. 1-2 times it works, after that stops working and shows this error:
I/flutter (25833): [MethodChannelFilePicker] Platform exception: PlatformException(already_active, File picker is already active, null, null) E/flutter (25833): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(already_active, File picker is already active, null, null)
is there any solution for this?