Closed joepake closed 6 years ago
@ohmygodntt you say you're seeing this on an emulator, could you give me some steps to reproduce the crash?
@samtstern please check out my repository https://github.com/ohmygodntt/easypermissioncrash I had define 2 cases in https://github.com/ohmygodntt/easypermissioncrash/blob/master/app/build.gradle
Case 1: compileSdkVersion 26 targetSdkVersion 26 support libs verion 26.1.0
Request Permissions button -> Deny first permission, Allow the second permission Request Permissions button again -> Deny first permission, Deny the second permission -> Crash (Application is restarted)
Case 2: compileSdkVersion 25 targetSdkVersion 23 support libs verion 25.3.1
Request Permissions button -> Deny first permission, Deny the second permission
Request Permissions button again -> Crash
Process: com.test.easypermissionscrash, PID: 2918 java.lang.NoSuchMethodError: No virtual method isStateSaved()Z in class Landroid/support/v4/app/FragmentManager; or its super classes (declaration of 'android.support.v4.app.FragmentManager' appears in /data/app/com.test.easypermissionscrash-2/split_lib_dependencies_apk.apk) at pub.devrel.easypermissions.RationaleDialogFragmentCompat.showAllowingStateLoss(RationaleDialogFragmentCompat.java:47) at pub.devrel.easypermissions.helper.BaseSupportPermissionsHelper.showRequestPermissionRationale(BaseSupportPermissionsHelper.java:29) at pub.devrel.easypermissions.helper.PermissionHelper.requestPermissions(PermissionHelper.java:75) at pub.devrel.easypermissions.EasyPermissions.requestPermissions(EasyPermissions.java:217) at pub.devrel.easypermissions.EasyPermissions.requestPermissions(EasyPermissions.java:105) at com.test.easypermissionscrash.MainActivity.methodRequiresTwoPermission(MainActivity.java:25)
@ohmygodntt Use the support library version 27.0.2
and the crash should go away.
@SUPERCILEX I changed like your comment but still crash. App is restarted compileSdkVersion 27 targetSdkVersion 27 support libs verion 27.0.2
I have the same problem when I deny one of the permissions
@ohmygodntt thanks for taking the time to make a test case! I will check it out now.
@ohmygodntt ok i tried your repo. To summarize:
Case 1
compileSdkVersion 26
targetSdkVersion 26
supportLibraryVersion 26.1.0
I was not able to produce any crash here.
Case 2
compileSdkVersion 25
targetSdkVersion 23
supportLibraryVersion 25.3.1
I was able to produce the crash as you said.
Case 3
compileSdkVersion 27
targetSdkVersion 26
supportLibraryVersion 27.0.2
I was not able to produce any crash here.
Before each test I did a clean install:
$ adb shell pm uninstall com.test.easypermissionscrash; ./gradlew :app:installDebug
So my conclusion is that @SUPERCILEX is right, you need to update to support library 27+. If you can reproduce a crash in that situation happy to try again.
Ohhh wait! I think there's definitely an issue here: https://github.com/googlesamples/easypermissions/issues/187
This should be fixed 1.1.1
. I took "Case 2" and checked the dependency tree against 1.1.0 and 1.1.1-SNAPSHOT;
Before
debug
debugCompileClasspath - Dependencies for compilation
+--- com.android.support:appcompat-v7:25.3.1@aar
+--- pub.devrel:easypermissions:1.1.0@aar
+--- com.android.support:animated-vector-drawable:25.3.1@aar
+--- com.android.support:support-vector-drawable:25.3.1@aar
+--- com.android.support:support-v4:25.3.1@aar
+--- com.android.support:support-fragment:25.3.1@aar
+--- com.android.support:support-media-compat:25.3.1@aar
+--- com.android.support:support-core-utils:25.3.1@aar
+--- com.android.support:support-core-ui:25.3.1@aar
+--- com.android.support:support-compat:25.3.1@aar
\--- com.android.support:support-annotations:25.3.1@jar
After
> Task :app:androidDependencies
debug
debugCompileClasspath - Dependencies for compilation
+--- pub.devrel:easypermissions:1.1.1-SNAPSHOT@aar
+--- com.android.support:appcompat-v7:27.0.1@aar
+--- com.android.support:support-fragment:27.0.1@aar
+--- com.android.support:animated-vector-drawable:27.0.1@aar
+--- com.android.support:support-core-ui:27.0.1@aar
+--- com.android.support:support-core-utils:27.0.1@aar
+--- com.android.support:support-vector-drawable:27.0.1@aar
+--- com.android.support:support-compat:27.0.1@aar
+--- com.android.support:support-annotations:27.0.1@jar
+--- android.arch.lifecycle:runtime:1.0.0@aar
+--- android.arch.lifecycle:common:1.0.0@jar
\--- android.arch.core:common:1.0.0@jar
Now the app does not build in Case 2 ... which is at least progress from a runtime crash!
Ok confirmed:
If you use easypermissions 1.1.1
and compileSdkVersion 27
you don't get this crash anymore.
Basic Information
Device type: Crash on Emulator and some real devices OS version: 6.0.0 EasyPermissions version: 1.1.0
Describe the problem
Crash when the user denies the permission request.
logs