Hi i am not able to pick file app get crashed when i select any file.
I an using android device.
Issue printed in console
E/AndroidRuntime( 1459): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
E/AndroidRuntime( 1459): at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run(FilePickerDelegate.java:92)
E/AndroidRuntime( 1459): at java.lang.Thread.run(Thread.java:919)
Hi, how are you picking the file?
Hi, how are you picking the file?
I am using this code
void pickFile() async {
setState(() => _loadingPath = true);
try {
_path = null;
_path = await FilePicker.getFilePath(
type: _pickingType, allowedExtensions: (_extension?.isNotEmpty ?? false) ? _extension?.replaceAll(' ', '')?.split(',') : null);
} on PlatformException catch (e) {
print("Unsupported operation" + e.toString());
}
if (!mounted) return;
setState(() {
_loadingPath = false;
_fileName = _path != null ? _path.split('/').last : _paths != null ? _paths.keys.toString() : '...';
});
}
Please, don’t use that. That’s an example code that’s made to fit a lot of use cases with a few lines and shouldn’t be used at on your project.
Check the plugin’s Wiki that has a lot of well documented examples for each use case and let me know if it worked for you.
Thanks!
Please, don’t use that. That’s an example code that’s made to fit a lot of use cases with a few lines and shouldn’t be used at on your project.
Check the plugin’s Wiki that has a lot of well documented examples for each use case and let me know if it worked for you.
Thanks!
Now i used this code but app still crashing
File extraFile = await FilePicker.getFile(type: FileType.any);
setState(() {
fileName = basename(extraFile.path);
});
Error Logs
E/AndroidRuntime(20193): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
E/AndroidRuntime(20193): at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run(FilePickerDelegate.java:92)
E/AndroidRuntime(20193): at java.lang.Thread.run(Thread.java:919)
E/FilePickerUtils(20193): Document URI
E/FilePickerUtils(20193): External Document URI
E/FilePickerUtils(20193): Primary External Document URI
I/FilePickerDelegate(20193): Absolute file path:/storage/emulated/0/Download/dbs-postgraduate-fees-2015-16.pdf
@maxbhoria when you run the example app, does that happen?
@maxbhoria when you run the example app, does that happen?
No this is not happened when i download code from github.
Hum, there must be something in your project that's resulting in type being null. Which file_picker version are you on? By looking at your stack trace, it's invoking type as null in a place where it _can't_ be null.
Also, run a full flutter clean and build again.
Hum, there must be something in your project that's resulting in
typebeing null. Which file_picker version are you on? By looking at your stack trace, it's invokingtypeasnullin a place where it _can't_ benull.Also, run a full
flutter cleanand build again.
Plugin version is file_picker: ^1.10.0
tried many time with flutter clean
Can you tell me how to directly use github plugin directly in my app?
If you can't reproduce it with the example app, then likely there must be something related to some conflict on your project.
There's no need to use the github project directly on your project as it won't make any difference or whatsoever, but may help you get rid of cached issues. You can give it a try. Just use it like this:
file_picker:
git: https://github.com/miguelpruivo/flutter_file_picker.git
If you can't reproduce it with the example app, then likely there must be something related to some conflict on your project.
There's no need to use the github project directly on your project as it won't make any difference or whatsoever, but may help you get rid of cached issues. You can give it a try. Just use it like this:
file_picker: git: https://github.com/miguelpruivo/flutter_file_picker.git
ok thanks, let me try this!
file_picker:
git: https://github.com/miguelpruivo/flutter_file_picker.git
it also did not worked error is same
Yes, like I told you, pubdev has the same version. I really would like to help you, but I quite don't get what might be triggering it. Maybe post your code block that's asking for the picker.
Yes, like I told you, pubdev has the same version. I really would like to help you, but I quite don't get what might be triggering it. Maybe post your code block that's asking for the picker.
however it does not require any specific setting for android
Yes, like I told you, pubdev has the same version. I really would like to help you, but I quite don't get what might be triggering it. Maybe post your code block that's asking for the picker.
This is complete log have a look in that please
D/SurfaceView(31692): windowStopped(true) false io.flutter.embedding.android.FlutterSurfaceView{9be883b V.E...... ........ 0,0-1080,2301} of ViewRootImpl@98d2c27[MainActivity]
D/FlutterView(31692): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@4d2e4be
D/SurfaceView(31692): onWindowVisibilityChanged(4) false io.flutter.embedding.android.FlutterSurfaceView{9be883b V.E...... .......D 0,0-1080,2301} of ViewRootImpl@98d2c27[MainActivity]
D/ViewRootImpl@98d2c27MainActivity: Relayout returned: old=(0,0,1080,2340) new=(0,0,1080,2340) req=(1080,2340)4 dur=12 res=0x1 s={false 0} ch=false
I/FilePickerDelegate(31692): [SingleFilePick] File URI:content://com.android.externalstorage.documents/document/primary%3ADownload%2F4w2E4661.jpg
E/FilePickerUtils(31692): Getting for API 19 or abovecontent://com.android.externalstorage.documents/document/primary%3ADownload%2F4w2E4661.jpg
D/ViewRootImpl@98d2c27MainActivity: stopped(false) old=true
D/SurfaceView(31692): windowStopped(false) false io.flutter.embedding.android.FlutterSurfaceView{9be883b V.E...... .......D 0,0-1080,2301} of ViewRootImpl@98d2c27[MainActivity]
E/AndroidRuntime(31692): FATAL EXCEPTION: Thread-6
E/AndroidRuntime(31692): Process: com.babymotherprescription, PID: 31692
E/AndroidRuntime(31692): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
E/AndroidRuntime(31692): at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run(FilePickerDelegate.java:92)
E/AndroidRuntime(31692): at java.lang.Thread.run(Thread.java:919)
D/ViewRootImpl@98d2c27MainActivity: stopped(false) old=false
E/FilePickerUtils(31692): Document URI
E/FilePickerUtils(31692): External Document URI
E/FilePickerUtils(31692): Primary External Document URI
I/FilePickerDelegate(31692): Absolute file path:/storage/emulated/0/Download/4w2E4661.jpg
D/SurfaceView(31692): onWindowVisibilityChanged(0) true io.flutter.embedding.android.FlutterSurfaceView{9be883b V.E...... .......D 0,0-1080,2301} of ViewRootImpl@98d2c27[MainActivity]
D/ViewRootImpl@98d2c27MainActivity: Relayout returned: old=(0,0,1080,2340) new=(0,0,1080,2340) req=(1080,2340)0 dur=14 res=0x7 s={true 496188772352} ch=true
D/OpenGLRenderer(31692): createReliableSurface : 0x740b61bd00, 0x738727d000
I/mali_winsys(31692): new_window_surface() [1080x2340] return: 0x3000
D/SurfaceView(31692): surfaceCreated 1 #8 io.flutter.embedding.android.FlutterSurfaceView{9be883b V.E...... .......D 0,0-1080,2301}
D/SurfaceView(31692): surfaceChanged (1080,2301) 1 #8 io.flutter.embedding.android.FlutterSurfaceView{9be883b V.E...... .......D 0,0-1080,2301}
I/Process (31692): Sending signal. PID: 31692 SIG: 9
i tried with another new project but the output is same. Have you find anything or have you tried by creating new project to check?
Do you remember any other settings that you did in your example because i don't how your example running perfectly
is this the problem because of i am using kotlin and your plugin is in java?? Because i copy your android folder from the example and i paste it into my sample it worked for me
It shouldn't have any issue with kotlin projects. But try recreating your project from scratch or run flutter create . on your project so it can add missing files and run it again.
Hello
I commented this code in plugin FilePickerDeligate.java, will it create any further issue in my application?
// if (type.equals("dir") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// uri = DocumentsContract.buildDocumentUriUsingTree(uri, DocumentsContract.getTreeDocumentId(uri));
// }
If you’re not planning to pick directories then not. I forgot to ask, what’s the minimum Android sdk of your app?
If you’re not planning to pick directories then not. I forgot to ask, what’s the minimum Android sdk of your app?
yes of course i don't have plan to pick dir as of now but Please make a fix for this problem and my mini sdk is 21.
Thanks for your support
@maxbhoria I can’t make a fix if I don’t get what’s triggering your issue but I’ll give it a look, could you please tell me details of your app’s build gradle and which version your android device is on?
You can check by creating a new project what wrong is triggered beacause i tried by creating new project also.
I am using Andorid 10 and this is app level gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.babymotherprescription"
minSdkVersion 21
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
@maxbhoria if you want a quick workaround, use file_picker: 1.7.0.
I was facing the same issue here, strangely enough, the code was working on Friday 5.
The older version "solved" it.
@nicolas-costa did you update it since Friday? The last update only introduced directory picks but for some reason this issue results in file type (apparently) being null where it _can’t_ be, still trying to understand what might be resulting in it but no luck so far.
@miguelpruivo I didn't intentionally updated it. What I can tell you is that I installed it last week to make some tests and see if it would fit my needs. I followed the docs, where, as you know, it instructs to add "file_picker: ^1.7.1". It was working perfectly.
Then it stopped working somehow. I messed around trying to figure it out, without luck. Then stumbled on this version bump (1.10.0) on my pubspec file, found this issue and had the idea to rollback to 1.7. Boom, working again.
So I guess the package manager updated it for me due to the: ^.
@nicolas-costa using the carrot operator ^ should only update automatically patch versions (1.0.x) and not minor. Anyhow, is your log trace identically to this one with 1.10.0?
@miguelpruivo Yes, it is.
I searched about the carrot operator in dart dependency manager and found that it will update patch and minor versions.
https://dart.dev/tools/pub/dependencies#version-constraints
@maxbhoria just tried exactly like you, in a new project, Android 10 emulator, minSdk set to 21 and no issues whatsoever.
I'm running on a Mac but that shouldn't be a problem.
@nicolas-costa if you are experiencing the same issue with 1.10.0 I really would like to fix it, but I need to be able to replicate it, so please, give me all the details you can:
Thanks!
@maxbhoria just tried exactly like you, in a new project, Android 10 emulator, minSdk set to 21 and no issues whatsoever.
I'm running on a Mac but that shouldn't be a problem.
@nicolas-costa if you are experiencing the same issue with 1.10.0 I really would like to fix it, but I need to be able to replicate it, so please, give me all the details you can:
- Your build gradle version restrictions;
- Your device version/name and if it's an emulator;
- Other relevant info;
Thanks!
@miguelpruivo Thanks for your efforts i am also using mac machine with samsung M30s Real device with 10.
If you project is unable to get crash than i can do one thing i can share you my demo project code which i have tried as a sample. So that you address this issue.
Thanks
@miguelpruivo I am sharing my sample app code in which i am getting the crash issue. Please check this out to address the bug.
https://drive.google.com/file/d/1cS4kd_F9k_WByLZt9Zl0SPdkPCxuo6I_/view?usp=sharing
Thanks!
@maxbhoria thank you for your effort, just tried to replicate it with your project, and it's working perfectly. See the gif below:

@maxbhoria thank you for your effort, just tried to replicate it with your project, and it's working perfectly. See the gif below:
have you checked it with real device?
@maxbhoria no, will try right now.
@maxbhoria update: just tried it, with a Samsung A40 on Android 10, works fine as well. 😞

@miguelpruivo I have attached my gif which showing the crash in my real device with android 10 or i also tried at android 6.

@miguelpruivo you can check this as well now its really difficult to understand whats happening with me
@maxbhoria what is your device?
Samsung M30s with Android 10.
@maxbhoria what if you pick a file from other location instead of the Recent folder?
same thing happens every time
@maxbhoria do you have a different device where you can test it on? Maybe with an emulator?
@miguelpruivo i also tried on micromax device with android 6 but no result.
Could you please try on the same emulator that I'm using? We need to figure if it's an issue with the build or the device. I'm using Nexus 5X with API 29.
Could you please try on the same emulator that I'm using? We need to figure if it's an issue with the build or the device. I'm using Nexus 5X with API 29.
ok i will check and update you.
@miguelpruivo can we connect on any other platform?
@maxbhoria don't get me wrong, but I'd rather keep it here so others can keep trace of what's happening if they experience the same issue.
@maxbhoria don't get me wrong, but I'd rather keep it here so others can keep trace of what's happening if they experience the same issue.
@miguelpruivo i am asking for others things like i need to ask some other problem i am facing which is not related to this.
@miguelpruivo I tried with simulator app still crashing.
@maxbhoria I don't know what else to tell you, other than completely get rid of pub cache on your machine and rebuild again. As you can see, I can't replicate on my end. Would you mind trying with the plugin's example app on simulator and record it with the logs if possible?
Thanks.
@maxbhoria I don't know what else to tell you, other than completely get rid of pub cache on your machine and rebuild again. As you can see, I can't replicate on my end. Would you mind trying with the plugin's example app on simulator and record it with the logs if possible?
Thanks.
i already tried with your example it was working fine in my device also and also i replace my android folder with you example android folder than it works for me. I am not getting what exactly happening.
@maxbhoria follow this steps and see if it helps.
ok i will try these
@maxbhoria found any solution?, I'm facing same issue and i've tested on two different devices
Hello
I commented this code in plugin FilePickerDeligate.java, will it create any further issue in my application?// if (type.equals("dir") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// uri = DocumentsContract.buildDocumentUriUsingTree(uri, DocumentsContract.getTreeDocumentId(uri));
// }
you can do this if you do not want to pick folder
Thanks
I have the same problem. Any idea?
v1.11.0+2
Syncing files to device MI 8 Lite...
W/Gralloc3( 3235): mapper 3.x is not supported
W/Looper ( 3235): Slow Looper main: doFrame is 349ms late because of 2 msg, msg 1 took 359ms (seq=10 late=38ms h=android.view.Choreographer$FrameHandler c=android.view.Choreographer$FrameDisplayEventReceiver)
I/ru.beeline.dol( 3235): ProcessProfilingInfo new_methods=490 is saved saved_to_disk=1 resolve_classes_delay=8000
D/FilePickerDelegate( 3235): Selected type /
I/Timeline( 3235): Timeline: Activity_launch_request time:243034211
D/FlutterView( 3235): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@71e4910
I/FilePickerDelegate( 3235): [SingleFilePick] File URI:content://com.android.providers.media.documents/document/image%3A108732
E/FilePickerUtils( 3235): Getting for API 19 or abovecontent://com.android.providers.media.documents/document/image%3A108732
E/AndroidRuntime( 3235): FATAL EXCEPTION: Thread-4
E/AndroidRuntime( 3235): Process: ru.beeline.dol, PID: 3235
E/AndroidRuntime( 3235): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
E/AndroidRuntime( 3235): at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run(FilePickerDelegate.java:106)
E/AndroidRuntime( 3235): at java.lang.Thread.run(Thread.java:919)
E/FilePickerUtils( 3235): Document URI
E/FilePickerUtils( 3235): Media Document URI
I/FilePickerUtils( 3235): Image Media Document URI
E/MQSEventManagerDelegate( 3235): failed to get MQSService.
I/FilePickerDelegate( 3235): Absolute file path:/storage/emulated/0/VK/Downloads/wkl7KXuYpNA.jpg
I/Process ( 3235): Sending signal. PID: 3235 SIG: 9
I have the same problem. Any idea?
v1.11.0+2
Syncing files to device MI 8 Lite...
W/Gralloc3( 3235): mapper 3.x is not supported
W/Looper ( 3235): Slow Looper main: doFrame is 349ms late because of 2 msg, msg 1 took 359ms (seq=10 late=38ms h=android.view.Choreographer$FrameHandler c=android.view.Choreographer$FrameDisplayEventReceiver)
I/ru.beeline.dol( 3235): ProcessProfilingInfo new_methods=490 is saved saved_to_disk=1 resolve_classes_delay=8000
D/FilePickerDelegate( 3235): Selected type _/_
I/Timeline( 3235): Timeline: Activity_launch_request time:243034211
D/FlutterView( 3235): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@71e4910
I/FilePickerDelegate( 3235): [SingleFilePick] File URI:content://com.android.providers.media.documents/document/image%3A108732
E/FilePickerUtils( 3235): Getting for API 19 or abovecontent://com.android.providers.media.documents/document/image%3A108732
E/AndroidRuntime( 3235): FATAL EXCEPTION: Thread-4
E/AndroidRuntime( 3235): Process: ru.beeline.dol, PID: 3235
E/AndroidRuntime( 3235): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
E/AndroidRuntime( 3235): at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run(FilePickerDelegate.java:106)
E/AndroidRuntime( 3235): at java.lang.Thread.run(Thread.java:919)
E/FilePickerUtils( 3235): Document URI
E/FilePickerUtils( 3235): Media Document URI
I/FilePickerUtils( 3235): Image Media Document URI
E/MQSEventManagerDelegate( 3235): failed to get MQSService.
I/FilePickerDelegate( 3235): Absolute file path:/storage/emulated/0/VK/Downloads/wkl7KXuYpNA.jpg
I/Process ( 3235): Sending signal. PID: 3235 SIG: 9
Hello
I commented this code in plugin FilePickerDeligate.java,
// if (type.equals("dir") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// uri = DocumentsContract.buildDocumentUriUsingTree(uri, DocumentsContract.getTreeDocumentId(uri));
// }
you can do this if you do not want to pick folder
Thanks
If this is affecting multiple users I’d be glad to help, just need to figure what’s triggering the issue, this is, being able to replicate it.
So if anyone manage to create a sample app and replicate it with simulator, please share the details.
Thank you!
I have the same problem. Any idea?
v1.11.0+2
Syncing files to device MI 8 Lite...
W/Gralloc3( 3235): mapper 3.x is not supported
W/Looper ( 3235): Slow Looper main: doFrame is 349ms late because of 2 msg, msg 1 took 359ms (seq=10 late=38ms h=android.view.Choreographer$FrameHandler c=android.view.Choreographer$FrameDisplayEventReceiver)
I/ru.beeline.dol( 3235): ProcessProfilingInfo new_methods=490 is saved saved_to_disk=1 resolve_classes_delay=8000
D/FilePickerDelegate( 3235): Selected type _/_
I/Timeline( 3235): Timeline: Activity_launch_request time:243034211
D/FlutterView( 3235): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@71e4910
I/FilePickerDelegate( 3235): [SingleFilePick] File URI:content://com.android.providers.media.documents/document/image%3A108732
E/FilePickerUtils( 3235): Getting for API 19 or abovecontent://com.android.providers.media.documents/document/image%3A108732
E/AndroidRuntime( 3235): FATAL EXCEPTION: Thread-4
E/AndroidRuntime( 3235): Process: ru.beeline.dol, PID: 3235
E/AndroidRuntime( 3235): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
E/AndroidRuntime( 3235): at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run(FilePickerDelegate.java:106)
E/AndroidRuntime( 3235): at java.lang.Thread.run(Thread.java:919)
E/FilePickerUtils( 3235): Document URI
E/FilePickerUtils( 3235): Media Document URI
I/FilePickerUtils( 3235): Image Media Document URI
E/MQSEventManagerDelegate( 3235): failed to get MQSService.
I/FilePickerDelegate( 3235): Absolute file path:/storage/emulated/0/VK/Downloads/wkl7KXuYpNA.jpg
I/Process ( 3235): Sending signal. PID: 3235 SIG: 9Hello
I commented this code in plugin FilePickerDeligate.java,// if (type.equals("dir") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// uri = DocumentsContract.buildDocumentUriUsingTree(uri, DocumentsContract.getTreeDocumentId(uri));
// }you can do this if you do not want to pick folder
Thanks
Thanks, It works! Good workaround. I will try to make an example for reproduce error and more details
My app also crash String _filePath;
void getFilePath() async {
try {
String filePath = await FilePicker.getFilePath(
type: FileType.any,
);
if (filePath == '') {
return;
}
print("File path: " + filePath);
setState(() {
this._filePath = filePath;
});
} on PlatformException catch (e) {
print("Error while picking the file: " + e.toString());
}
}
this is my code
My app also crash String _filePath;
void getFilePath() async {
try {
String filePath = await FilePicker.getFilePath(
type: FileType.any,
);
if (filePath == '') {
return;
}
print("File path: " + filePath);
setState(() {
this._filePath = filePath;
});
} on PlatformException catch (e) {
print("Error while picking the file: " + e.toString());
}
}this is my code
please share console log.
Getting the same issue
I could add a null check for that line of code in Android, but I don't like adding null checks without understanding what may be triggering them because it could hide other potential issues.
Where that issue happens, it _shouldn't ever_ be null. So if anyone manages to replicate this issue with an Android emulator, let me know the details so I can actually debug it and implement a definitive fix and not just a workaround.
So far, only users with some physical devices had this, which doesn't help at all. @praharshbhatt did you get it on emulator?
Thanks!
Yes, got this in the emulator. Tried on multiple API versions.
I am also fashing same issue when i choose photo from recent folder app getting crashed.
@miguelpruivo Please fix this issue many users are reporting it. I already shared you my sample code in which i am getting error. You can try different system.
Thanks
it's giving error on this line
if (type.equals("dir") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
uri = DocumentsContract.buildDocumentUriUsingTree(uri, DocumentsContract.getTreeDocumentId(uri));
}
If you manage to replicate it on the emulator, please, give me the details for it.
I’ve not yet fixed it because I wasn’t able to reproduce it. 😕
2020-06-24 15:20:22.149 1876-2000/system_process E/TaskPersister: File error accessing recents directory (directory doesn't exist?).
2020-06-24 15:20:24.922 18016-18195/com.svc_app E/FilePickerUtils: Getting for API 19 or abovecontent://com.android.providers.media.documents/document/image%3A96
2020-06-24 15:20:24.926 18016-18196/com.svc_app E/AndroidRuntime: FATAL EXCEPTION: Thread-5
Process: com.svc_app, PID: 18016
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run(FilePickerDelegate.java:106)
at java.lang.Thread.run(Thread.java:764)
2020-06-24 15:20:24.934 18016-18195/com.svc_app E/FilePickerUtils: Document URI
2020-06-24 15:20:24.934 18016-18195/com.svc_app E/FilePickerUtils: Media Document URI
i tried in emulator android version 9 & 10
also tried in real device oneplus 5t android version 10
min sdk version 21
compileSdkVersion 29
targetSdkVersion 29
also tried different filepicker version
for now fliepicker version file_picker: ^1.12.0

see when i tried to pick image from that particular folder i am getting crash
@nikitaIndianic thanks, I'm looking into it. Does that happen only with that folder?
i tried with nexus 5x emulator in this device i am getting crash while selection image from download folder too.
@nikitaIndianic just tried creating a new 5x emulator with the settings you gave me and it works flawlessly. There must be something else triggering the issue.
If you look into the source code, you see that the type can't be null where it is saying it is, as I have a type null check just a few lines before that. Oddly, in your activity result, the type becomes null magically.
Does that happen in a brand new Flutter project? Would you mind to try please?
yes i have tried in new project but getting same issue.
yes i am too confused because before that it's working fine.
@nikitaIndianic post your flutter doctor -v here please.
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.3 19D76, locale en-IN)
• Flutter version 1.12.13+hotfix.9 at /Users/indianic/flutterSDk/flutter
• Framework revision f139b11009 (3 months ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/indianic/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.9.2
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Connected device (1 available)
• Android SDK built for x86 64 • emulator-5556 • android-x64 • Android 10 (API 29) (emulator)
• No issues found!
@nikitaIndianic hum, you are in an old stable that's more than 6 months old, despite having a few earlier hotfixes (I'm currently on the latest 1.17). Would you mind trying flutter upgrade and try afterwards? Might be related.
i used this version bcs in latest stable version giving issue while we long press on edittext it is not giving paste option.
still let me try with latest version
@nikitaIndianic that's weird. Copy/paste is working properly for me. Let me know if it made any difference.
yes in latest version it's working
[✓] Flutter (Channel stable, v1.17.3, on Mac OS X 10.15.3 19D76, locale en-IN)
• Flutter version 1.17.3 at /Users/indianic/flutterSDk/flutter
• Framework revision b041144f83 (3 weeks ago), 2020-06-04 09:26:11 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/indianic/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.9.2
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Connected device (1 available)
• Android SDK built for x86 64 • emulator-5556 • android-x64 • Android 10 (API 29) (emulator)
• No issues found!
but i am facing issue with copy/paste will you please verify once is it option working on latest stable version
Ok, so basically this is an issue with Flutter on older versions, surprisingly. @maxbhoria would you mind upgrading Flutter to latest stable as well and see if its working for you? Thanks!
Ok, so basically this is an issue with Flutter on older versions, surprisingly. @maxbhoria would you mind upgrading Flutter to latest stable as well and see if its working for you? Thanks!
@miguelpruivo Sure, I will try this later and update here.
Thanks
Im also facing the same issue
app crashes after picking a file
but i am facing issue with copy/paste will you please verify once is it option working on latest stable version
read this and try
To anyone experiencing this, please make sure you update to latest Flutter stable (currently 1.17).
I am too facing the same issue
app crashes after picking a file. Please help me.
I am too facing the same issue
app crashes after picking a file. Please help me.
Hi, try upgrade your flutter version
Thx. It is working.
Closing as we’ve finally found the solution. To anyone reading/experiencing this:
Please update to latest Flutter stable version and it should be fixed.
Thanks!
Closing as we’ve finally found the solution. To anyone reading/experiencing this:
Please update to latest Flutter stable version and it should be fixed.
Thanks!
i would like to thank to @miguelpruivo and @nikitaIndianic who finally find the reason behind this problem.
Thanks
@maxbhoria thanks for reporting, I'll refer this on the Wiki troubleshooting section as well.
Same here bro,..
File image;
void selectimage() async {
image=await FilePicker.getFile();
setState(() {
image=image;
imagepath=basename(image.path);
uploadimagefile(image.readAsBytesSync(),imagepath);
});
}
it just keep exits,................................
V/MusicPlayerPlugin(16068): Activity Save Instance State
I/FilePickerDelegate(16068): [SingleFilePick] File URI:content://com.android.externalstorage.documents/document/primary%3AIMG_20171213_095703670_HDR-01.jpeg
E/FilePickerUtils(16068): Getting for API 19 or abovecontent://com.android.externalstorage.documents/document/primary%3AIMG_20171213_095703670_HDR-01.jpeg
E/AndroidRuntime(16068): FATAL EXCEPTION: Thread-7
E/AndroidRuntime(16068): Process: com.example.ebplayer, PID: 16068
E/AndroidRuntime(16068): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
E/AndroidRuntime(16068): at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run(FilePickerDelegate.java:106)
E/AndroidRuntime(16068): at java.lang.Thread.run(Thread.java:764)
V/MusicPlayerPlugin(16068): Activity Started
V/MusicPlayerPlugin(16068): Activity Resumed
E/FilePickerUtils(16068): Document URI
E/FilePickerUtils(16068): External Document URI
E/FilePickerUtils(16068): Primary External Document URI
I/FilePickerDelegate(16068): Absolute file path:/storage/emulated/0/IMG_20171213_095703670_HDR-01.jpeg
I/Process (16068): Sending signal. PID: 16068 SIG: 9
Lost connection to device.
@DarK-C0deR Please update to latest Flutter stable version (1.17.x) and it should be fixed.
Tnq u Bro,...
Most helpful comment
Closing as we’ve finally found the solution. To anyone reading/experiencing this:
Please update to latest Flutter stable version and it should be fixed.
Thanks!