jaiselrahman / FilePicker

FilePicker library for Android
Apache License 2.0
238 stars 70 forks source link

ArrayIndexOutOfBoundsException length=0; index=0 error on android 10 #75

Open NaserKhoshfetrat opened 4 years ago

NaserKhoshfetrat commented 4 years ago

FilePickerActivity.java line 177 com.jaiselrahman.filepicker.activity.FilePickerActivity.onRequestPermissionsResult stack trace of crash

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
       at com.jaiselrahman.filepicker.activity.FilePickerActivity.onRequestPermissionsResult(FilePickerActivity.java:177)
       at android.app.Activity.requestPermissions(Activity.java:5141)
       at com.jaiselrahman.filepicker.activity.FilePickerActivity.requestPermission(FilePickerActivity.java:301)
       at com.jaiselrahman.filepicker.activity.FilePickerActivity.onCameraClick(FilePickerActivity.java:284)
       at com.jaiselrahman.filepicker.adapter.FileGalleryAdapter$1.onClick(FileGalleryAdapter.java:174)
       at android.view.View.performClick(View.java:7870)
       at android.view.View.performClickInternal(View.java:7839)
       at android.view.View.access$3600(View.java:886)
       at android.view.View$PerformClick.run(View.java:29363)
       at android.os.Handler.handleCallback(Handler.java:883)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:7814)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)

Device: Brand: samsung Model: Galaxy A50 Orientation: Portrait RAM free: 1.27 GB Disk free: 81.64 GB Operating System: Version: 10 Orientation: Portrait Rooted: No

my manifest permison:

   <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CAMERA" />

and on run time checking Manifest.permission.CAMERA permission

code im using to call

  Intent intent = new Intent(activity, FilePickerActivity.class);
  intent.putExtra(FilePickerActivity.CONFIGS, new Configurations.Builder()
                    .setCheckPermission(true)
                    .setShowImages(true)
                    .setShowVideos(false)
                    .enableImageCapture(true)
                    .setMaxSelection(1)
                    .setSkipZeroSizeFiles(true)
                    .build());
                fragment.startActivityForResult(intent, 454);
umer-sufyan commented 3 years ago

Well I had already permission code before this line of code, so this line never trigger any kind of permission, but there are other problems related to OS 10 , and 11, you won't be able to get Path of File, that is something needed to be fixed earlier

wantroba commented 3 years ago

Any update?