java.lang.NullPointerException: Parameter specified as non-null is null: method com.facebook.react.bridge.PromiseImpl.reject, parameter code
Root Cause Analysis
Library: [email protected] Problem Code: Android native module calls promise.reject(null, "error message") when errors occur React Native Policy Change: React Native 0.68+ no longer allows passing null as the first parameter (error code) in promise.reject() Library Status: Latest version (7.0.2) but Android code still uses legacy approach
Why Did This Happen?
React Native Changes: Recent versions enforced stricter @NonNull checks Library Updates: Version 7.0.0 update primarily addressed iOS privacy policy compliance; Android code was not updated Compatibility Issues: Worked in older React Native versions but causes crashes in newer versions
Problem Code Location File: node_modules/react-native-zip-archive/android/src/main/java/com/rnziparchive/RNZipArchiveModule.java Lines: 67, 82, 110, 125, 177, 215, 277, 341, 347, 363, 413, 420 (12 locations total)
Example:
// ❌ Incorrect Code (null is not allowed!)
catch (Exception ex) {
promise.reject(null, ex.getMessage());
return;
}
🔧 Patch Details Changes Made Modified all 12 instances of promise.reject(null, ...) → promise.reject("E_ZIP_ERROR", ...)
// ✅ Modified Code (error code added)
catch (Exception ex) {
promise.reject("E_ZIP_ERROR", ex.getMessage());
return;
}