Karumi / Dexter

Android library that simplifies the process of requesting permissions at runtime.
http://karumi.com
Apache License 2.0
5.23k stars 671 forks source link

java.lang.IllegalArgumentException ERROR IN device API 23 #273

Open cesarwillymc opened 3 years ago

cesarwillymc commented 3 years ago

ERROR CLOSE ACTIVITY

java.lang.RuntimeException: at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3319) at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3415) at android.app.ActivityThread.access$1100 (ActivityThread.java:229) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1821) at android.os.Handler.dispatchMessage (Handler.java:102) at android.os.Looper.loop (Looper.java:148) at android.app.ActivityThread.main (ActivityThread.java:7325) at java.lang.reflect.Method.invoke (Native Method) 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.IllegalArgumentException: at android.os.Parcel.readException (Parcel.java:1624) at android.os.Parcel.readException (Parcel.java:1573) at android.content.pm.IPackageManager$Stub$Proxy.shouldShowRequestPermissionRationale (IPackageManager.java:3682) at android.app.ApplicationPackageManager.shouldShowRequestPermissionRationale (ApplicationPackageManager.java:662) at android.app.Activity.shouldShowRequestPermissionRationale (Activity.java:4229) at androidx.core.app.ActivityCompat.shouldShowRequestPermissionRationale (ActivityCompat.java:549) at com.karumi.dexter.AndroidPermissionService.shouldShowRequestPermissionRationale (SourceFile) at com.karumi.dexter.DexterInstance.handleDeniedPermissions (SourceFile) at com.karumi.dexter.DexterInstance.onActivityReady (SourceFile) at com.karumi.dexter.Dexter.onActivityReady (SourceFile) at com.karumi.dexter.DexterActivity.onCreate (SourceFile) at android.app.Activity.performCreate (Activity.java:6904) at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1136) at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3266)

Coding

Dexter.withContext(this).withPermissions(
                listOf(
                    android.Manifest.permission.ACCESS_FINE_LOCATION,
                    android.Manifest.permission.ACCESS_COARSE_LOCATION,
                    Manifest.permission.CAMERA,
                    Manifest.permission.READ_EXTERNAL_STORAGE,
                    Manifest.permission.WRITE_EXTERNAL_STORAGE
                )
            ).withListener(object : MultiplePermissionsListener {
                override fun onPermissionsChecked(p0: MultiplePermissionsReport?) {
                    when(destination.id){
                        R.id.register->{
                            toolbar_main.show()
                        }
                        R.id.galleryFragment->{
                            toolbar_main.hide()
                        }
                        else->{
                            toolbar_main.show()
                            viewodel.imageSelect.postValue("")
                        }
                    }
                }

                override fun onPermissionRationaleShouldBeShown(
                    p0: MutableList<com.karumi.dexter.listener.PermissionRequest>?,
                    p1: PermissionToken?
                ) {
                    p1!!.continuePermissionRequest()
                }
            }).check()

DEVICEE

 Error in J5 android 6 api 23 

VERSION

implementation 'com.karumi:dexter:6.2.1'

pedrovgs commented 3 years ago

Hi @cesarwillymc I'm afraid with the information you provide I'm not able to see what's going on. Could you upload a reproducible sample? The code you provided should work.