Skip to content

Commit

Permalink
feat(android): enable hermes engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Calinteodor committed Nov 11, 2024
1 parent efd1aaf commit 3646c31
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
23 changes: 17 additions & 6 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ if (googleServicesEnabled) {
// https://stackoverflow.com/a/38643838
def vcode = (int) (((new Date().getTime() / 1000) - 1546297200) / 10)


/**
* The preferred build flavor of JavaScriptCore.
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*/
def jscFlavor = 'org.webkit:android-jsc:+'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
// packagingOptions {
// jniLibs {
// excludes += ['lib/*/libhermes*.so']
// }
// }


defaultConfig {
applicationId 'org.jitsi.meet'
Expand Down Expand Up @@ -77,7 +80,15 @@ android {
namespace 'org.jitsi.meet'
}


dependencies {

if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android:+")
} else {
implementation jscFlavor
}

implementation 'androidx.appcompat:appcompat:1.5.1'

debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.13'
Expand Down
5 changes: 2 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ buildscript {
}

ext {
kotlinVersion = "1.9.0"
buildToolsVersion = "33.0.2"
kotlinVersion = "1.9.24"
buildToolsVersion = "34.0.0"
compileSdkVersion = 34
minSdkVersion = 24
targetSdkVersion = 34
supportLibVersion = "28.0.0"

// NDK is now entirely compatible with Apple Silicon M1 and M2 Macs as of version 24.0.
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "26.1.10909125"

// The Maven artifact groupId of the third-party react-native modules which
Expand Down
7 changes: 4 additions & 3 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

android.bundle.enableUncompressedNativeLibs=false

# This one fixes a weird WebRTC runtime problem on some devices.
# https://github.com/jitsi/jitsi-meet/issues/7911#issuecomment-714323255
android.enableDexingArtifactTransform.desugaring=false

android.useAndroidX=true
android.hermesEnabled=true
android.enableJetifier=true
android.bundle.enableUncompressedNativeLibs=false
hermesEnabled=true
android.useAndroidX=true

appVersion=99.0.0
sdkVersion=0.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

import androidx.annotation.Nullable;

import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.common.LifecycleState;
import com.facebook.react.jscexecutor.JSCExecutorFactory;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.uimanager.ViewManager;
import com.oney.WebRTCModule.EglUtils;
Expand All @@ -37,7 +37,6 @@

import org.devio.rn.splashscreen.SplashScreenModule;
import org.webrtc.EglBase;
import org.webrtc.Logging;

import java.lang.reflect.Constructor;
import java.util.ArrayList;
Expand Down Expand Up @@ -156,9 +155,8 @@ public List<ViewManager> createViewManagers(ReactApplicationContext reactContext
return packages;
}

static JSCExecutorFactory getReactNativeJSFactory() {
// Keep on using JSC, the jury is out on Hermes.
return new JSCExecutorFactory("", "");
static HermesExecutorFactory getHermesExecutorFactory() {
return new HermesExecutorFactory();
}

/**
Expand Down Expand Up @@ -240,7 +238,7 @@ static void initReactInstanceManager(Activity activity) {
.setCurrentActivity(activity)
.setBundleAssetName("index.android.bundle")
.setJSMainModulePath("index.android")
.setJavaScriptExecutorFactory(getReactNativeJSFactory())
.setJavaScriptExecutorFactory(getHermesExecutorFactory())
.addPackages(getReactNativePackages())
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
Expand Down

0 comments on commit 3646c31

Please sign in to comment.