Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions android/src/main/java/com/reactlibrary/ReactContextBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.facebook.react.bridge.queue.ReactQueueConfigurationSpec;
import com.facebook.react.devsupport.interfaces.DevSupportManager;
import com.facebook.soloader.SoLoader;
import com.facebook.v8.reactexecutor.V8ExecutorFactory;

import java.util.ArrayList;
import java.util.concurrent.Callable;
Expand Down Expand Up @@ -65,8 +66,19 @@ private JavaScriptExecutorFactory getJSExecutorFactory() {
SoLoader.loadLibrary("jscexecutor");
return new JSCExecutorFactory(appName, deviceName);
} catch (UnsatisfiedLinkError jscE) {
// Otherwise use Hermes
return new HermesExecutorFactory();
// Otherwise try using hermes
try {
// we try whether we can start the hermes js executor.
// If it fails with an UnsatisfiedLinkError we know
// that it is not available.
JavaScriptExecutor hermes = new HermesExecutorFactory().create();
// stop if we were successful
hermes.close();
return new HermesExecutorFactory();
} catch (UnsatisfiedLinkError|NoClassDefFoundError e) {
// try v8
return new V8ExecutorFactory();
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"android/",
"ios/",
"js/",
"index.js"
"index.js",
"react-native.config.js"
],
"peerDependencies": {
"react-native": ">=0.50.0"
Expand Down