react-native-multiple-image-picker
react-native-multiple-image-picker copied to clipboard
fix(android): replace getClass() with javaClassStatic()
Summary
This PR fixes a crash on Android 8+ caused by using _javaPart->getClass()
to retrieve the Java class.
The correct approach is to use _javaPart->javaClassStatic(),
which avoids compatibility issues.
Changes
- Replaced
_javaPart->getClass()with_javaPart->javaClassStatic() - Based on a similar fix from react-native-nitro: https://github.com/mrousavy/nitro/pull/582
Why?
On certain devices, getClass() is not allowed and leads to crashes
when trying to access JNI methods. This update ensures better compatibility.
Test Plan
- Tested on Android 8, 10, 13.
- Confirmed that
openPicker()and other related functions work as expected.