Open MuhamedFathy opened 8 years ago
The problem is that you haven't requested permission for Android version 6+ https://github.com/nbsp-team/MaterialFilePicker/issues/13
I'm getting these also on Android 4.2 so it can't be just the Android 6+ permissions.
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.money.manager.ex/com.nbsp.materialfilepicker.ui.FilePickerActivity}: java.lang.NullPointerException: storage == null
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
at android.app.ActivityThread.access$1100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by java.lang.NullPointerException: storage == null
at java.util.Arrays$ArrayList.<init>(Arrays.java:38)
at java.util.Arrays.asList(Arrays.java:155)
at com.nbsp.materialfilepicker.utils.FileUtils.getFileListByDirPath(FileUtils.java:16)
at com.nbsp.materialfilepicker.ui.DirectoryFragment.initFilesList(DirectoryFragment.java:84)
at com.nbsp.materialfilepicker.ui.DirectoryFragment.onViewCreated(DirectoryFragment.java:79)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:998)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1163)
at android.app.BackStackRecord.run(BackStackRecord.java:793)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1552)
at android.app.FragmentController.execPendingActions(FragmentController.java:325)
at android.app.Activity.performStart(Activity.java:6914)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3216)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
at android.app.ActivityThread.access$1100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
The issue is not with android M or any other. I was able to recreate it today on Samsung J5 Android 5.1.1, but in my crashlogs from production this exact stactrace is visible also on 4.2.2.
Would be nice to add error handling when listing directory returns "null" due to no access
Easy steps to reproduce: Environment: stock Samsung J5, android 5.1.1
Intent filePickerIntent = new Intent(context, FilePickerActivity.class); filePickerIntent.putExtra(FilePickerActivity.ARG_START_PATH, "/");
Process: com.jobartis.staging, PID: 18417
java.lang.NullPointerException: storage == null
at java.util.Arrays$ArrayList.<init>(Arrays.java:38)
at java.util.Arrays.asList(Arrays.java:155)
at com.nbsp.materialfilepicker.utils.FileUtils.getFileListByDirPath(FileUtils.java:16)
at com.nbsp.materialfilepicker.ui.DirectoryFragment.initFilesList(DirectoryFragment.java:84)
at com.nbsp.materialfilepicker.ui.DirectoryFragment.onViewCreated(DirectoryFragment.java:79)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:919)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1083)
at android.app.BackStackRecord.run(BackStackRecord.java:834)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1470)
at android.app.FragmentManagerImpl$1.run(FragmentManager.java:452)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6934)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)```