nguyenhoanglam / ImagePicker

A customizable library for selecting images on the device.
Apache License 2.0
598 stars 158 forks source link

Crashing on Android 13 #158

Closed dozy-programmer closed 5 months ago

dozy-programmer commented 7 months ago

I am seeing a recurring crash for Android 13 devices.

Fatal Exception: java.lang.RuntimeException Unable to start activity ComponentInfo{com.example.myapp/com.nguyenhoanglam.imagepicker.ui.imagepicker.ImagePickerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Class.isInterface()' on a null object reference

I am not able to dig much deeper, since none of the users have reached out, but maybe @nguyenhoanglam has an idea on how this might be possible?

Edit: Was able to dig a little deeper

// this line is what is causing the crashing
config = if (DeviceHelper.isMinSdk33) intent.getParcelableExtra(
            Constants.EXTRA_CONFIG, ImagePickerConfig::class.java
        )!! else intent.getParcelableExtra(Constants.EXTRA_CONFIG)!!
        config.initDefaultValues(this@ImagePickerActivity)

File at com.nguyenhoanglam.imagepicker.ui.imagepicker.ImagePickerActivity.onCreate (ImagePickerActivity.kt:94)

nguyenhoanglam commented 7 months ago

@dozy-programmer look like this is a bug of Parcelable.

https://stackoverflow.com/questions/75953723/android-intent-getparcelablearraylistextra-on-arraylistlatlng-raises-nullpoint

I've just reverted the code to use the old methods. Please check 1.6.3 and let me know if it's fixed. Thanks!

dozy-programmer commented 7 months ago

thanks @nguyenhoanglam, I will let you know if users are still having issues. Appreciate the fix!

dozy-programmer commented 5 months ago

Issue completely fixed, thanks!