@@ -297,8 +297,34 @@ private JavaScriptExecutorFactory getDefaultJSExecutorFactory(
297
297
SoLoader .loadLibrary ("jscexecutor" );
298
298
return new JSCExecutorFactory (appName , deviceName );
299
299
} catch (UnsatisfiedLinkError jscE ) {
300
+ // https://github.com/facebook/hermes/issues/78 shows that
301
+ // people who aren't trying to use Hermes are having issues.
302
+ // https://github.com/facebook/react-native/issues/25923#issuecomment-554295179
303
+ // includes the actual JSC error in at least one case.
304
+ //
305
+ // So, if "__cxa_bad_typeid" shows up in the jscE exception
306
+ // message, then we will assume that's the failure and just
307
+ // throw now.
308
+
309
+ if (jscE .getMessage ().contains ("__cxa_bad_typeid" )) {
310
+ throw jscE ;
311
+ }
312
+
300
313
// Otherwise use Hermes
301
- return new HermesExecutorFactory ();
314
+ try {
315
+ return new HermesExecutorFactory ();
316
+ } catch (UnsatisfiedLinkError hermesE ) {
317
+ // If we get here, either this is a JSC build, and of course
318
+ // Hermes failed (since it's not in the APK), or it's a Hermes
319
+ // build, and Hermes had a problem.
320
+
321
+ // We suspect this is a JSC issue (it's the default), so we
322
+ // will throw that exception, but we will print hermesE first,
323
+ // since it could be a Hermes issue and we don't want to
324
+ // swallow that.
325
+ hermesE .printStackTrace ();
326
+ throw jscE ;
327
+ }
302
328
}
303
329
}
304
330
}
0 commit comments