It will be a personal app or it will go on the Play Store?
If it's for personal use I think that setting
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>
in the Manifest will solve many problems.
But you can take a look here
https://www.b4x.com/android/forum/threads/externalstorage-access-sd-cards-and-usb-sticks.90238/