Skip to content

Commit

Permalink
pick between JSC & Hermes for Android (#20171)
Browse files Browse the repository at this point in the history
We implement both `JSC` and `Hermes` in build phase of `Android` which increases our `APK` size by ~ `2 MB`.
This was fine before but currently we have to get below the `100 MB` limit.

This commit implements the preferred engine after inferring `hermesEnabled`  property from gradle.properties
This property is modified at build time for release here
https://github.com/status-im/status-mobile/blob/178d62bd276afffef5fe7a3f773e390d83336d9c/nix/mobile/android/build.nix#L17
and set for debug here
https://github.com/status-im/status-mobile/blob/178d62bd276afffef5fe7a3f773e390d83336d9c/Makefile#L280

Which should further reduce the `APK` size by `2 MB`.
  • Loading branch information
siddarthkay committed May 24, 2024
1 parent e30ca97 commit f65c105
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def jscFlavor = 'org.webkit:android-jsc:+'
*/
def enableHermes = hermesEnabled.toBoolean();


def getCommitHash = { ->
if (project.hasProperty("commitHash")) {
return project.commitHash
Expand Down Expand Up @@ -278,11 +277,14 @@ dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
implementation("androidx.core:core-splashscreen:1.0.0")
// we don't use hermes for debug but we need its pom file for release builds
// https://github.com/status-im/status-mobile/pull/18675
implementation("com.facebook.react:hermes-android")
// FIXME: implementing both hermes & JSC increases bundle size by ~ 2MB
implementation(jscFlavor)

if (enableHermes) {
implementation("com.facebook.react:hermes-android")
} else {
// https://github.com/status-im/status-mobile/issues/18493
// we don't use hermes for debug builds because it crashes too often
implementation(jscFlavor)
}

// react-native-screens
implementation("androidx.appcompat:appcompat:1.1.0-rc01")
Expand Down
3 changes: 2 additions & 1 deletion nix/deps/gradle/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ com.android.tools.build:gradle:8.1.1
com.google.errorprone:error_prone_annotations:2.7.1
com.android.tools.lint:lint-gradle:31.1.1
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0
com.android.tools.build:gradle:3.5.4' \
com.android.tools.build:gradle:3.5.4
com.facebook.react:hermes-android:0.73.5' \
>> "${DEPS_LIST}"
}

Expand Down

0 comments on commit f65c105

Please sign in to comment.