You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -7,35 +7,25 @@ This is demo repo is used by Solution Engineers when demo'ing Sentry's [React Na
7
7
8
8
## Versions
9
9
10
+
The values specified in package.json may be more up to date.
11
+
Not all of these have to be used in order to build the app (e.g. Android Virtual Device API) but if you're having problems building, then follow these.
10
12
| dependency | version
11
13
| ------------- |:-------------:|
12
-
| react-native | 0.64.0 |
13
-
| gradle | 6.7 |
14
-
| react | 16.13.1 |
15
-
| sentry/react-native | 2.4.0 |
16
-
| npx | 7.8.0 |
17
-
| cocoapods | +1.10.1 |
14
+
| react-native | 0.72.4 |
15
+
| gradle | 8.0.1 |
16
+
| react | 18.2.0 |
17
+
| sentry/react-native | ^5.9.1 |
18
+
| npx | 7.8.0? |
19
+
| node | 20.5.0 |
20
+
| npm | 9.8.0 |
21
+
| java | 17.0.8 |
22
+
| ruby | 3.2.2 |
23
+
| AndroidStudio | Bumblebee 2021.1.1 Patch 2 |
24
+
| Android Virtual Device | Pixel_6_API_30 |
18
25
19
-
## Setup (Bootstrap)
20
-
21
-
[INSTALL.md](./Install.md) was written by the CreateReactNativeApp maintainers and outlines some things you'll need.
22
-
23
-
This step was already performed for adding the sdk to sentry_react_native, but it's good to know it was used as customers will use it:
24
-
```
25
-
$npx @sentry/wizard -i reactNative -p ios android
26
-
```
27
-
The above command launches the [Sentry wizard](https://github.com/getsentry/sentry-wizard) allowing you to [link](https://docs.sentry.io/platforms/react-native/#linking) with the correct Sentry react-native project.
28
-
From our [documentation](https://docs.sentry.io/platforms/react-native/), the following changes happen which you should be aware of:
29
-
```
30
-
- add the sentry-android package for native crash reporting on Android
31
-
- add the sentry-cocoa package for native crash reporting on iOS
32
-
- enable the Sentry Gradle build step for Android
33
-
- patch MainApplication.java for Android
34
-
- configure Sentry for the supplied DSN in your index.js/App.js files
35
-
- store build credentials in ios/sentry.properties and android/sentry.properties.
36
-
```
37
26
38
27
## Setup
28
+
See 'Versions' table above for some dependencies you'll need. Recommend using [sdkman](sdkman.io) for easily installing the right Java version. And [rbenv](http://rbenv.org/) or [rvm](https://rvm.io/) to install the right Ruby version.
 | |
87
-
88
-
## Upgrade SDK path
89
-
1. npm install, then `cd ios && pod update` if `pod install` is failing. The pod updating depends on node_modules/@sentry/react-native being set.
90
-
2. Review previous PR so you know what to expect.
91
-
92
-
## Troubleshooting
93
-
94
-
#### Repo
95
-
This repo borrowed from [original react-native repo ](https://github.com/sentry-demos/react-native/commit/269f58d63426065a4de67a3f22d2e774787cd996)
96
-
The following may have been borrowed: `package.json`, `package-lock.json`, `ios/Podfile`, `ios/Podfile.lock`, see [pull/2](https://github.com/sentry-demos/sentry_react_native/pull/2)
97
-
98
-
Please know that react-native generates it own [.gitignore file](https://stackoverflow.com/questions/49099131/recommended-gitignore-for-react-native/49099219
99
-
), which is of course part of this repo, so only those [autogenerated files](https://stackoverflow.com/questions/48448426/why-dont-we-gitignore-ios-and-android-in-react-native) that are required for a baseline setup and the original demo code (files) are part of this repo.
100
-
101
-
Please see [Steps](#what-were-the-steps-again) or go through the [first ten commits](https://github.com/sentry-demos/sentry_react_native/commits/master) (and their git log) messages in chronological order, to see the exact commands that were run and what files that were autogenerated.
102
-
103
-
#### What were the steps again
104
-
This is just the background steps to answer "How did we get here ?" . Below is not needed/related to the demoing this app.
62
+
// optional, do this if you think you're not getting the updated app on your emulator
63
+
./gradlew installRelease // Installs release build of the app to the currently connected Android device/emulator
105
64
```
106
-
// generates boilerplate code
107
-
npx react-native init sentry_react_native
108
-
cd sentry_react_native
109
-
cd ios
110
-
// Edit Podfile to remove/comment out flipper install as suggested in the comments of the file itself
Gradle commands allow you to gradually control what you want to do, like avoiding rebuilding the app if you changed your emulator.
69
+
cd android
70
+
./gradlew installDebug // Installs debug build of the app to the currently connected Android device/emulator
71
+
./gradlew installRelease // Installs release build of the app to the currently connected Android device/emulator
118
72
119
-
#### adding Sentry for first time
120
-
When running npx @sentry/wizard -i reactNative -p ios android
121
-
At this point, you may get an error like:
122
-
`TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined`
123
-
It should be safe to look past this error. A minor issue is that it blocks creation of `ios/sentry.properties`. So simply make a copy of `android/sentry.properties` and put it in `ios/sentry.properties`:
Android (optional) start the emulator by AVD Manager or:
129
78
130
-
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):
79
+
// emulator executable is at /Users/<user>/Library/Android/sdk/emulator
"error: Can't find the 'node' binary to build the React Native bundle." should be okay
94
+
These steps were last tested before Sept 6th, 2023:
95
+
Deprecation warning on using npx?
96
+
```
97
+
# opens the Metro debugger, has hot reload
98
+
npx react-native run-ios --configuration Debug
155
99
156
-
If tools don't load, then swipe-away (kill) the app, then relaunch from app menu in the emulator. If still fails, then go to AVD Manager and 'wipe' the device and run the emulator again.
157
-
Could also be a problem with the backend container/app you're requesting the tools from (check that URL/Postman, check TDA job)
100
+
## builds a Release (takes longer)
101
+
npx react-native run-ios --configuration Release
102
+
npx react-native run-ios --simulator="iPhone 11"
103
+
```
158
104
159
-
When developing locally, must point React Native to http://127.0.0.1:8080/products backend instead of https://localhost:8080/products backend.
105
+
## SDK Upgrade Path
106
+
1.`rm -rf node_modules && npm install`. For iOS, run `pod install --repo-update`. For Android, it should pull in latest dependenices automatically as you start building again.
107
+
2. If you're getting build errors, you may need to upgrade all your Node, npm, Java, VirtualDevices. This is due to either the previously merged PR relying on them, or the next SDK and RN versions you're upgrading to require them, or both.
160
108
161
109
# How To Create a Release
162
110
@@ -248,6 +196,14 @@ Note: do not proceed with this until you have done all the previous steps.
248
196
249
197
Your new release should be [visible on Github](https://github.com/sentry-demos/sentry_react_native/releases).
250
198
199
+
### Updating the version of the Demo App itself
200
+
Don't forget to bump your release version depending on platform.
201
+
iOS: `Info.plist``CFBundleShortVersionString`
202
+
android: `app.build.gradle``versionName`
203
+
204
+
## Troubleshooting
205
+
[Troubleshooting.md](./troubleshooting.md)
206
+
251
207
### [Troubleshooting - Locally undoing an accidental increment of the release version]
252
208
253
209
If you accidentally tick the version forward by running `npm version patch`, and did not intend to do so, you can undo this.
@@ -260,4 +216,5 @@ Let's say we were previously on `2.0.1` and accidentally ran the command twice,
260
216

261
217
262
218
- run `git reset <the commit hash>`.
263
-
- Check out any unwanted files that are no longer staged for commit.
219
+
- Check out any unwanted files that are no longer staged for commit.
Only do this if you're having trouble upgrading the Sentry SDK or existing RN version. Sometimes it's more efficient to bootstrap a new app from scratch, but you'll have a ton of app source code to port over. Consider that state management could work differently in a newer version of RN.
3
+
4
+
[INSTALL.md](./Install.md) was written by the CreateReactNativeApp maintainers and outlines some things you'll need.
5
+
6
+
This step was already performed for adding the sdk to sentry_react_native, but it's good to know it was used as customers will use it:
7
+
```
8
+
$npx @sentry/wizard -i reactNative -p ios android
9
+
```
10
+
The above command launches the [Sentry wizard](https://github.com/getsentry/sentry-wizard) allowing you to [link](https://docs.sentry.io/platforms/react-native/#linking) with the correct Sentry react-native project.
11
+
From our [documentation](https://docs.sentry.io/platforms/react-native/), the following changes happen which you should be aware of:
12
+
```
13
+
- add the sentry-android package for native crash reporting on Android
14
+
- add the sentry-cocoa package for native crash reporting on iOS
15
+
- enable the Sentry Gradle build step for Android
16
+
- patch MainApplication.java for Android
17
+
- configure Sentry for the supplied DSN in your index.js/App.js files
18
+
- store build credentials in ios/sentry.properties and android/sentry.properties.
19
+
```
20
+
21
+
#### Repo
22
+
This repo borrowed from [original react-native repo ](https://github.com/sentry-demos/react-native/commit/269f58d63426065a4de67a3f22d2e774787cd996)
23
+
The following may have been borrowed: `package.json`, `package-lock.json`, `ios/Podfile`, `ios/Podfile.lock`, see [pull/2](https://github.com/sentry-demos/sentry_react_native/pull/2)
24
+
25
+
Please know that react-native generates it own [.gitignore file](https://stackoverflow.com/questions/49099131/recommended-gitignore-for-react-native/49099219
26
+
), which is of course part of this repo, so only those [autogenerated files](https://stackoverflow.com/questions/48448426/why-dont-we-gitignore-ios-and-android-in-react-native) that are required for a baseline setup and the original demo code (files) are part of this repo.
27
+
28
+
Please see [Steps](#what-were-the-steps-again) or go through the [first ten commits](https://github.com/sentry-demos/sentry_react_native/commits/master) (and their git log) messages in chronological order, to see the exact commands that were run and what files that were autogenerated.
29
+
30
+
#### What were the steps again
31
+
This is just the background steps to answer "How did we get here ?" . Below is not needed/related to the demoing this app.
32
+
```
33
+
// generates boilerplate code
34
+
npx react-native init sentry_react_native
35
+
cd sentry_react_native
36
+
cd ios
37
+
// Edit Podfile to remove/comment out flipper install as suggested in the comments of the file itself
When running npx @sentry/wizard -i reactNative -p ios android
48
+
At this point, you may get an error like:
49
+
`TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined`
50
+
It should be safe to look past this error. A minor issue is that it blocks creation of `ios/sentry.properties`. So simply make a copy of `android/sentry.properties` and put it in `ios/sentry.properties`:
51
+
```
52
+
cp andoid/sentry.properties ios/sentry.properties
53
+
cd ios
54
+
pod install
55
+
```
56
+
57
+
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):
58
+
59
+
```
60
+
sudo rm -rf android/ ios/
61
+
yarn add react-native-eject
62
+
npx react-native eject
63
+
```
64
+
65
+
#### Emulators
66
+
When running emulator...
67
+
If the app launches and suddenly crashes you may need to reinstall your node package with this command:
68
+
69
+
```
70
+
rm -rf node_modules
71
+
npm install
72
+
```
73
+
74
+
Emulator needs Internet access enabled on your Android emulator. Use AVD Manager or:
75
+
76
+
#### Running
77
+
You may run into issues if you haven't added sdk and sdk platform-tools to path:
"error: Can't find the 'node' binary to build the React Native bundle." should be okay
82
+
83
+
If tools don't load, then swipe-away (kill) the app, then relaunch from app menu in the emulator. If still fails, then go to AVD Manager and 'wipe' the device and run the emulator again.
84
+
Could also be a problem with the backend container/app you're requesting the tools from (check that URL/Postman, check TDA job)
85
+
86
+
When developing locally, must point React Native to http://127.0.0.1:8080/products backend instead of https://localhost:8080/products backend.
87
+
88
+
89
+
90
+
91
+
## Other
92
+
update to java 17 or 20
93
+
```
94
+
sdk man curl -s "https://get.sdkman.io" | bash
95
+
sdk install java 17.0.8-zulu
96
+
```
97
+
98
+
upgrade android emulator
99
+
100
+
101
+
```
102
+
adb kill-server
103
+
adb start-server
104
+
```
105
+
106
+
uninstall the app from the emulator, if you're not sure it's getting refreshed.
107
+
108
+
TODO?
109
+
RN demo: rub 3.2.2 for RN iOS
110
+
root folder > bundle install > setups cocopods for ruby
111
+
pod install [or pod update first]
112
+
113
+
114
+
how do you NOT have to uninstall the app from the virtualdevice, and have to re-build, then installRelease. is there a more streamlined way to do it, that does not involve `npm run android` which has known issues?
0 commit comments