diff --git a/android/app/build.gradle b/android/app/build.gradle index 7aaf84bffd4e..34d43c0cff6f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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' @@ -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' diff --git a/android/build.gradle b/android/build.gradle index af5306755742..7f7233c5840e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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 diff --git a/android/gradle.properties b/android/gradle.properties index 8f665591d91c..7abf57d21d6f 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -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 diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java index 29845721be57..a2a4bf29d8d1 100644 --- a/android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java +++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java @@ -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; @@ -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; @@ -156,9 +155,8 @@ public List 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(); } /** @@ -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)