Skip to content

Commit 53edb0e

Browse files
Merge pull request #2 from sentryadam0000345/hermesworking
Hermes is working
2 parents ec846fb + 64b3642 commit 53edb0e

20 files changed

+2716
-1873
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
## Who am I
22

3+
This is demo repo is used by Solution Engineers when demo'ing Sentry's [React Native](https://docs.sentry.io/platforms/react-native) SDK's capabilties.
4+
5+
## Versions Summary:
6+
7+
| dependency | version
8+
| ------------- |:-------------:|
9+
| react-native | 0.64.0 |
10+
| gradle | 6.7 |
11+
| react | 16.13.1 |
12+
| sentry/react-native | 2.4.0 |
13+
14+
15+
16+
17+
18+
19+
20+
321
This is demo repo is used by Solution Engineers when demo'ing Sentry's [React Native](https://docs.sentry.io/platforms/react-native) SDK's capabilties.
422

523
## Where do I begin
@@ -28,6 +46,34 @@ cd ios
2846
pod install
2947
```
3048

49+
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:
50+
51+
```
52+
emulator -list-avds
53+
54+
emulator @{YourEmulator} -dns-server 8.8.8.8
55+
```
56+
57+
If you are experiencing issues with running the following launch command:
58+
59+
If the app launches and suddenly crashes you may need to reinstall your node package with this command:
60+
61+
```
62+
rm -rf node_modules
63+
64+
npm install
65+
```
66+
67+
If all else fails and you seem to be getting a weird error related to IllegalAccessErrors or anything else you may need to rebuild your Android and iOS folders using the following (just make sure to grab the sentry.properties files, build.gradle files, and pod files from Github afterwards):
68+
69+
```
70+
sudo rm -rf android/ ios/
71+
72+
yarn add react-native-eject
73+
74+
npx react-native eject
75+
```
76+
3177
### To Launch the Demo apps:
3278

3379
* _iOS version_: `npx react-native run-ios --configuration Release`

android/app/build.gradle

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
apply plugin: "com.android.application"
22

3+
apply plugin: 'io.sentry.android.gradle'
4+
35
import com.android.build.OutputFile
46

57
/**
@@ -77,8 +79,9 @@ import com.android.build.OutputFile
7779
* ]
7880
*/
7981

82+
// This is for enabling Hermes
8083
project.ext.react = [
81-
enableHermes: false, // clean and rebuild if changing
84+
enableHermes: true, // clean and rebuild if changing
8285
]
8386

8487
apply from: "../../node_modules/react-native/react.gradle"
@@ -97,7 +100,7 @@ def enableSeparateBuildPerCPUArchitecture = false
97100
/**
98101
* Run Proguard to shrink the Java bytecode in release builds.
99102
*/
100-
def enableProguardInReleaseBuilds = false
103+
def enableProguardInReleaseBuilds = true
101104

102105
/**
103106
* The preferred build flavor of JavaScriptCore.
@@ -119,9 +122,11 @@ def jscFlavor = 'org.webkit:android-jsc:+'
119122
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
120123
* and the benefits of using Hermes will therefore be sharply reduced.
121124
*/
122-
def enableHermes = project.ext.react.get("enableHermes", false);
125+
def enableHermes = project.ext.react.get("enableHermes", true);
123126

124127
android {
128+
ndkVersion rootProject.ext.ndkVersion
129+
125130
compileSdkVersion rootProject.ext.compileSdkVersion
126131

127132
compileOptions {
@@ -170,11 +175,12 @@ android {
170175
variant.outputs.each { output ->
171176
// For each separate APK per architecture, set a unique version code as described here:
172177
// https://developer.android.com/studio/build/configure-apk-splits.html
178+
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
173179
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
174180
def abi = output.getFilter(OutputFile.ABI)
175181
if (abi != null) { // null for the universal-debug, universal-release variants
176182
output.versionCodeOverride =
177-
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
183+
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
178184
}
179185

180186
}
@@ -184,10 +190,13 @@ android {
184190
dependencies {
185191
implementation fileTree(dir: "libs", include: ["*.jar"])
186192
//noinspection GradleDynamicVersion
187-
implementation "com.facebook.react:react-native:+" // From node_modules
193+
implementation "com.facebook.react:react-native:0.64.0" // From node_modules
188194

195+
//AndroidX UX Widget, https://developer.android.com/jetpack/androidx/releases/swiperefreshlayout
189196
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
190197

198+
//Flipper is a debugging tool for React Native, https://fbflipper.com/
199+
191200
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
192201
exclude group:'com.facebook.fbjni'
193202
}

android/app/proguard-rules.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
# http://developer.android.com/guide/developing/tools/proguard.html
99

1010
# Add any project specific keep options here:
11+
12+
-keep class com.facebook.hermes.unicode.** { *; }
13+
-keep class com.facebook.jni.** { *; }

android/app/src/debug/AndroidManifest.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@
44

55
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
66

7-
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
7+
<application
8+
android:usesCleartextTraffic="true"
9+
tools:targetApi="28"
10+
tools:ignore="GoogleAppIndexingWarning">
11+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
12+
</application>
813
</manifest>

android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,5 @@
2121
<category android:name="android.intent.category.LAUNCHER" />
2222
</intent-filter>
2323
</activity>
24-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
2524
</application>
26-
2725
</manifest>

android/app/src/main/res/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<resources>
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
4+
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
55
<!-- Customize your theme here. -->
66
<item name="android:textColor">#000000</item>
77
</style>

android/build.gradle

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22

33
buildscript {
44
ext {
5-
buildToolsVersion = "29.0.2"
6-
minSdkVersion = 16
5+
buildToolsVersion = "29.0.3"
6+
minSdkVersion = 21
77
compileSdkVersion = 29
88
targetSdkVersion = 29
9+
ndkVersion = "20.1.5948944"
910
}
1011
repositories {
1112
google()
1213
jcenter()
14+
mavenCentral()
1315
}
1416
dependencies {
15-
classpath("com.android.tools.build:gradle:3.5.3")
17+
classpath("com.android.tools.build:gradle:4.1.0")
18+
classpath 'io.sentry:sentry-android-gradle-plugin:1.7.36'
1619
// NOTE: Do not place your application dependencies here; they belong
1720
// in the individual module build.gradle files
1821
}

android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ android.useAndroidX=true
2525
android.enableJetifier=true
2626

2727
# Version of flipper SDK to use with React Native
28-
FLIPPER_VERSION=0.37.0
28+
FLIPPER_VERSION=0.75.1
508 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)