-
Notifications
You must be signed in to change notification settings - Fork 11
Hermes is working #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
f3c9344
a6539f1
fe061b9
0d95b4b
37b0d6e
0bb2e93
05403ec
4334b8f
64b3642
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,15 @@ cd ios | |
| pod install | ||
| ``` | ||
|
|
||
| Make sure to have Internet access enabled on your Android emulator. If you can't access the browser you may need to launch your emulator with the below commands: | ||
|
|
||
| ``` | ||
| emulator -list-avds | ||
|
|
||
| emulator @{YourEmulator} -dns-server 8.8.8.8 | ||
| ``` | ||
|
|
||
|
|
||
| ### To Launch the Demo apps: | ||
|
|
||
| * _iOS version_: `npx react-native run-ios --configuration Release` | ||
|
|
@@ -88,3 +97,61 @@ cd .. | |
| ``` | ||
| Ran git commit along the way and finally pushed to this repo. | ||
|
|
||
| ## To enable a Hermes event | ||
|
|
||
| Android | ||
|
|
||
| In your build.gradle file make sure to have the | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is all of this already in the build.gradle file? If so, we don't have to repeat it all in the readme here. Update - I checked, I see it in your /android/app/build.gradle. My request - can you write "see /android/app/build.gradle" here under "To enable a Hermes event"? Then in android/app/build.gradle can you put a comment somewhere like I'm curious about the "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" and "facebook.flipper" things that I see, if those are for Hermes then put "// This is for Hermes" as it's not clear what swiperefresh and flipper are for. If those are for some UI behaviors (non-Hermes) then put a comment clarifying what they're for.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have a piece of documentation/tutorial/blog you worked off of for this? If you still can find it, if you could paste the link into the PR that'd be great. It's helpful if we're ever debugging Hermes stuff in the future.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| following: | ||
|
|
||
| ``` | ||
|
|
||
| def enableHermes = project.ext.react.get("enableHermes", true); | ||
|
|
||
| project.ext.react = [ | ||
| enableHermes: true, // clean and rebuild if changing | ||
| ] | ||
|
|
||
| dependencies { | ||
| implementation fileTree(dir: "libs", include: ["*.jar"]) | ||
| //noinspection GradleDynamicVersion | ||
| implementation "com.facebook.react:react-native:0.64.0" // From node_modules | ||
|
|
||
| implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" | ||
|
|
||
| debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { | ||
| exclude group:'com.facebook.fbjni' | ||
| } | ||
|
|
||
| debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { | ||
| exclude group:'com.facebook.flipper' | ||
| exclude group:'com.squareup.okhttp3', module:'okhttp' | ||
| } | ||
|
|
||
| debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { | ||
| exclude group:'com.facebook.flipper' | ||
| } | ||
|
|
||
| if (enableHermes) { | ||
| def hermesPath = "../../node_modules/hermes-engine/android/"; | ||
| debugImplementation files(hermesPath + "hermes-debug.aar") | ||
| releaseImplementation files(hermesPath + "hermes-release.aar") | ||
| } else { | ||
| implementation jscFlavor | ||
| } | ||
| } | ||
|
|
||
| ``` | ||
|
|
||
| iOS | ||
|
|
||
| In your Podfile before running pod install make sure to have the following: | ||
|
|
||
| ``` | ||
|
|
||
| use_react_native!( | ||
| :path => config["reactNativePath"], | ||
| :hermes_enabled => true | ||
| ) | ||
| ``` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| apply plugin: "com.android.application" | ||
|
|
||
| apply plugin: 'io.sentry.android.gradle' | ||
|
|
||
| import com.android.build.OutputFile | ||
|
|
||
| /** | ||
|
|
@@ -78,7 +80,7 @@ import com.android.build.OutputFile | |
| */ | ||
|
|
||
| project.ext.react = [ | ||
| enableHermes: false, // clean and rebuild if changing | ||
| enableHermes: true, // clean and rebuild if changing | ||
| ] | ||
|
|
||
| apply from: "../../node_modules/react-native/react.gradle" | ||
|
|
@@ -97,7 +99,7 @@ def enableSeparateBuildPerCPUArchitecture = false | |
| /** | ||
| * Run Proguard to shrink the Java bytecode in release builds. | ||
| */ | ||
| def enableProguardInReleaseBuilds = false | ||
| def enableProguardInReleaseBuilds = true | ||
|
|
||
| /** | ||
| * The preferred build flavor of JavaScriptCore. | ||
|
|
@@ -119,9 +121,11 @@ def jscFlavor = 'org.webkit:android-jsc:+' | |
| * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode | ||
| * and the benefits of using Hermes will therefore be sharply reduced. | ||
| */ | ||
| def enableHermes = project.ext.react.get("enableHermes", false); | ||
| def enableHermes = project.ext.react.get("enableHermes", true); | ||
|
|
||
| android { | ||
| ndkVersion rootProject.ext.ndkVersion | ||
|
|
||
| compileSdkVersion rootProject.ext.compileSdkVersion | ||
|
|
||
| compileOptions { | ||
|
|
@@ -170,11 +174,12 @@ android { | |
| variant.outputs.each { output -> | ||
| // For each separate APK per architecture, set a unique version code as described here: | ||
| // https://developer.android.com/studio/build/configure-apk-splits.html | ||
| // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. | ||
| def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] | ||
| def abi = output.getFilter(OutputFile.ABI) | ||
| if (abi != null) { // null for the universal-debug, universal-release variants | ||
| output.versionCodeOverride = | ||
| versionCodes.get(abi) * 1048576 + defaultConfig.versionCode | ||
| defaultConfig.versionCode * 1000 + versionCodes.get(abi) | ||
| } | ||
|
|
||
| } | ||
|
|
@@ -184,7 +189,7 @@ android { | |
| dependencies { | ||
| implementation fileTree(dir: "libs", include: ["*.jar"]) | ||
| //noinspection GradleDynamicVersion | ||
| implementation "com.facebook.react:react-native:+" // From node_modules | ||
| implementation "com.facebook.react:react-native:0.64.0" // From node_modules | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you indicate in the README (and PR would be nice too) what the current supported version of React Native is for our demo? Nice job with getting to 0.64.0 as that's the latest. I know it was missing previously but we're slowly updating all our demo's so the framework/platform version we're building on is always indicated. Mobile demo's are very sensitive to changes in this too so it's good to document.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
|
||
| implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" | ||
|
|
||
|
|
@@ -217,4 +222,31 @@ task copyDownloadableDepsToLibs(type: Copy) { | |
| into 'libs' | ||
| } | ||
|
|
||
| sentry { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this config section here for Hermes? Or is this for general
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was in general for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| // Disables or enables the automatic configuration of ProGuard | ||
| // for Sentry. This injects a default config for ProGuard so | ||
| // you don't need to do it manually. | ||
|
|
||
| // Only enable it if you are using sentry-android <= v1.7, | ||
| // sentry-android >= v2.0 already does it automatically. | ||
| autoProguardConfig true | ||
|
|
||
| // Enables or disables the automatic upload of mapping files | ||
| // during a build. If you disable this, you'll need to manually | ||
| // upload the mapping files with sentry-cli when you do a release. | ||
| autoUpload true | ||
|
|
||
| // Disables or enables the automatic configuration of Native Symbols | ||
| // for Sentry. This executes sentry-cli automatically so | ||
| // you don't need to do it manually. | ||
| // Default is disabled. | ||
| uploadNativeSymbols false | ||
|
|
||
| // Does or doesn't include the source code of native code for Sentry. | ||
| // This executes sentry-cli with the --include-sources param. automatically so | ||
| // you don't need to do it manually. | ||
| // Default is disabled. | ||
| includeNativeSources false | ||
| } | ||
|
|
||
| apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you put in the README that we're on gradle 6.7? A lot of times when people clone our mobile demo's and get errors when running, it's because they're not on the right versions of Gradle, so it's good to know what was last worked with.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, done |
||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| defaults.url=https://sentry.io/ | ||
| defaults.org=testorg-az | ||
| defaults.project=mobile-webinar | ||
| defaults.project=adamreactnative | ||
| auth.token=XXXX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious, are these the emulator commands you ended up using? Did you launch an emulator from CLI?
Or do you use the AVD through Android Studio?
if you could describe your workflow on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done