storage-chooser: [BUG] Android 11 Crash

This library seems to crash on Android 11. Is it planned to fix this? I dont get this error on other Android Versions

E/AndroidRuntime: FATAL EXCEPTION: main
    java.lang.NullPointerException: Attempt to get length of null array
        at com.codekidlabs.storagechooser.fragments.ChooserDialogFragment.populateList(ChooserDialogFragment.java:262)
        at com.codekidlabs.storagechooser.fragments.ChooserDialogFragment.initListView(ChooserDialogFragment.java:115)
        at com.codekidlabs.storagechooser.fragments.ChooserDialogFragment.getLayout(ChooserDialogFragment.java:85)
        at com.codekidlabs.storagechooser.fragments.ChooserDialogFragment.onCreateDialog(ChooserDialogFragment.java:300)
        at android.app.DialogFragment.onGetLayoutInflater(DialogFragment.java:417)
        at android.app.Fragment.performGetLayoutInflater(Fragment.java:1322)
        at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1303)
        at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2431)
        at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2210)
        at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2166)
        at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2067)
        at android.app.FragmentManagerImpl$1.run(FragmentManager.java:742)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

About this issue

Commits related to this issue

Most upvoted comments

No need for an alternative. Someone else (sfilmak) fixed it. I forked his fork, tagged it and created a release for it. Since the original library uses jitpack, it’s really easy to switch over to use your own fork of it. I just changed out: com.github.codekidX:storage-chooser:2.0.4.4

and replaced it with: com.github.mveroukis:storage-chooser:2.0.4.4a

The “a” at the end is my own tag, otherwise it would continue using the same version as the original. Now my app works in Android 11. As a bonus, it also uses newer versions of it’s dependencies and targets API 30.

Good idea @mveroukis The commit https://github.com/sfilmak/storage-chooser/commit/c43a6b534855da6b2e87fa0f25d0c67d40c84fbf contains other changes that broke my build. I have forked and uploaded a commit with the only change that fixes the crash on Android 11 devices. Here’s the my version:

https://github.com/NoelChew/storage-chooser/commit/f0ffc9ce5df35c9597eebc3b819093b74136e082

implementation 'com.github.noelchew:storage-chooser:2.0.4.4a'

Updated Dependencies, Optimised and compressed Resources and New Publishing Plugin

implementation("com.github.shabinder:storage-chooser:2.0.4.45")