jaiselrahman / FilePicker

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

ANR because Class Configuration not found when unmarshalling #91

Open rennovale opened 2 years ago

rennovale commented 2 years ago

Hello, thanks in advance. I hope this is not a bad configuration in my application, however since i can't find a cause for this to happen i'm sharing with you.

Describe the bug This issue happened only for two test samples: 1) Samsung note 10 - Android 11 2) Xiaomi Mi A2 - Android 10

I identified the error checking Android logs, as you can see below (That's the log for Samsung note 10 - Android 11)

12-02 08:44:29.151 1000 1015 3787 I ActivityTaskManager: START u0 {cmp=com.lmi.myapplication/com.jaiselrahman.filepicker.activity.FilePickerActivity (has extras)} from uid 10668 12-02 08:44:29.151 1000 1015 3787 E Parcel : Class not found when unmarshalling: com.jaiselrahman.filepicker.config.Configurations 12-02 08:44:29.151 1000 1015 3787 E Parcel : java.lang.ClassNotFoundException: com.jaiselrahman.filepicker.config.Configurations 12-02 08:44:29.151 1000 1015 3787 E Parcel : at java.lang.Class.classForName(Native Method) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at java.lang.Class.forName(Class.java:454) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at android.os.Parcel.readParcelableCreator(Parcel.java:3350) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at android.os.Parcel.readParcelable(Parcel.java:3284) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at android.os.Parcel.readValue(Parcel.java:3186) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at android.os.Parcel.readArrayMapInternal(Parcel.java:3579) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:292) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at android.os.BaseBundle.unparcel(BaseBundle.java:236) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at android.os.BaseBundle.getString(BaseBundle.java:1196) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at android.content.Intent.getStringExtra(Intent.java:8889) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:1128) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:894) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1721) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1571) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at com.android.server.wm.ActivityTaskManagerService.startActivity(ActivityTaskManagerService.java:1523) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at android.app.IActivityTaskManager$Stub.onTransact(IActivityTaskManager.java:1671) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at android.os.Binder.execTransactInternal(Binder.java:1190) 12-02 08:44:29.151 1000 1015 3787 E Parcel : at android.os.Binder.execTransact(Binder.java:1159) 12-02 08:44:29.151 1000 1015 3787 E Parcel : Caused by: java.lang.ClassNotFoundException: com.jaiselrahman.filepicker.config.Configurations 12-02 08:44:29.151 1000 1015 3787 E Parcel : ... 18 more 12-02 08:44:29.151 1000 1015 3787 W Bundle : Failed to parse Bundle, but defusing quietly 12-02 08:44:29.151 1000 1015 3787 W Bundle : android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.jaiselrahman.filepicker.config.Configurations 12-02 08:44:29.151 1000 1015 3787 W Bundle : at android.os.Parcel.readParcelableCreator(Parcel.java:3376) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at android.os.Parcel.readParcelable(Parcel.java:3284) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at android.os.Parcel.readValue(Parcel.java:3186) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at android.os.Parcel.readArrayMapInternal(Parcel.java:3579) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:292) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at android.os.BaseBundle.unparcel(BaseBundle.java:236) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at android.os.BaseBundle.getString(BaseBundle.java:1196) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at android.content.Intent.getStringExtra(Intent.java:8889) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:1128) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:894) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1721) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1571) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at com.android.server.wm.ActivityTaskManagerService.startActivity(ActivityTaskManagerService.java:1523) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at android.app.IActivityTaskManager$Stub.onTransact(IActivityTaskManager.java:1671) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at android.os.Binder.execTransactInternal(Binder.java:1190) 12-02 08:44:29.151 1000 1015 3787 W Bundle : at android.os.Binder.execTransact(Binder.java:1159)

My application crashes because FilePicker can't found Class 'Configurations' in execution time. This problem is reported in the moment that the application starts the FilePickerActivity. Since it can't found Configurations, the intent dies.

The code i'm using to call FilePicker follows:

import com.jaiselrahman.filepicker.activity.FilePickerActivity; import com.jaiselrahman.filepicker.config.Configurations; import com.jaiselrahman.filepicker.model.MediaFile;

...

Intent intent = new Intent(MainActivity.this, FilePickerActivity.class); intent.putExtra(FilePickerActivity.CONFIGS, new Configurations.Builder() .setCheckPermission(true) .setShowVideos(true) .setShowImages(false) .setSingleChoiceMode(true) .setSkipZeroSizeFiles(true) .build()); startActivityForResult(intent, REQUEST_SELECT_FILE_INTENT);

As you can see i'm filtering only for videos and single choice mode. I checked, and the class do exist, obviously.

My build.gradle:

dependencies { ... implementation 'com.github.jaiselrahman:FilePicker:1.3.2' }

To Reproduce Steps to reproduce the behavior:

  1. Try to start FilePicker in one of the samples above.

Expected behavior FilePicker can found class and run without problems as it happens for many other smartphones.

Android info (please complete the following information):