Tuesday, June 16, 2020

ReactNative OneSignal Android failed to compile RNOneSignal.java because bunch of unhandled JSONException

If you compile ReactNative Android OneSignal plugin and hit the unhandled
JSONException that thrown or triggered by 
callback.invoke(RNUtils.jsonToWritableMap(outcomeEvent.toJSONObject()));

Simply add this:
-- callback.invoke(RNUtils.jsonToWritableMap(outcomeEvent.toJSONObject()));

++ try {
++     callback.invoke(RNUtils.jsonToWritableMap(outcomeEvent.toJSONObject()));
++ }
++ catch (JSONException je ) {
++     je.printStackTrace();
++     return;
++ }

Hope it help ^^

No comments: