Commit 0ac7659
Fix Android crash when worklet throws error (#3558)
This PR improves developer experience of error handling in worklets by
showing a RedBox with full error message rather than crashing the whole
app on Android.
**Note:** Android with Fabric enabled works only if building with NDK 21
via `yarn react-native run-android [--active-arch-only]`, crashes when
building with NDK 24 from Android Studio, see
Shopify/flash-list#550 (comment)
for details (this is not an issue with Reanimated)
<table>
<thead>
<tr>
<th rowspan="2">Scenario</th>
<th colspan="2">Before</th>
<th colspan="2">After</th>
</tr>
<tr>
<th>Paper</th>
<th>Fabric</th>
<th>Paper</th>
<th>Fabric</th>
</thead>
<tbody>
<tr>
<td>worklet</td>
<td align="center">💥</td>
<td align="center">💥</td>
<td align="center">✅</td>
<td align="center">✅</td>
</tr>
<tr>
<td>nested worklet</td>
<td align="center">💥</td>
<td align="center">💥</td>
<td align="center">✅</td>
<td align="center">✅</td>
</tr>
<tr>
<td>useAnimatedStyle</td>
<td align="center">💥</td>
<td align="center">💥</td>
<td align="center">✅</td>
<td align="center">✅</td>
</tr>
<tr>
<td>useDerivedValue</td>
<td align="center">💥</td>
<td align="center">💥</td>
<td align="center">✅</td>
<td align="center">✅</td>
</tr>
<tr>
<td>useFrameCallback</td>
<td align="center">💥</td>
<td align="center">💥</td>
<td align="center">✅</td>
<td align="center">✅</td>
</tr>
<tr>
<td>GestureDetector</td>
<td align="center">💥</td>
<td align="center">💥</td>
<td align="center">✅</td>
<td align="center">✅</td>
</tr>
<tr>
<td>useAnimatedGestureHandler</td>
<td align="center">💥</td>
<td align="center">💥</td>
<td align="center">✅</td>
<td align="center">✅</td>
</tr>
<tr>
<td>useAnimatedScrollHandler</td>
<td align="center">💥</td>
<td align="center">💥</td>
<td align="center">✅</td>
<td align="center">✅</td>
</tr>
<tr>
<td>useScrollViewOffset</td>
<td align="center">💥</td>
<td align="center">💥</td>
<td align="center">✅</td>
<td align="center">✅</td>
</tr>
</tbody>
</table>
https://github.com/software-mansion/react-native-reanimated/blob/48af341d51ca289dc007fdfd81d124ae0c267523/FabricExample/android/build.gradle#L11-L17
```diff
- ndkVersion = "24.0.8215888"
+ ndkVersion = "21.4.7075529"
```
`ERROR: Unknown host CPU architecture: arm64`
```console
code ~/Library/Android/sdk/ndk/21.4.7075529/ndk-build
```
```diff
DIR="$(cd "$(dirname "$0")" && pwd)"
-$DIR/build/ndk-build "$@"
+arch -x86_64 $DIR/build/ndk-build "$@"
```
- [ ] Included code example that can be used to test this change
- [ ] Updated TS types
- [ ] Added TS types tests
- [ ] Added unit / integration tests
- [ ] Updated documentation
- [ ] Ensured that CI passes1 parent 907d937 commit 0ac7659
File tree
4 files changed
+4
-18
lines changed- android/src/main
- cpp
- java/com/swmansion/reanimated
4 files changed
+4
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
401 | | - | |
402 | 400 | | |
403 | 401 | | |
404 | 402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 21 | + | |
24 | 22 | | |
| 23 | + | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | | - | |
22 | | - | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
| |||
Lines changed: 0 additions & 8 deletions
This file was deleted.
0 commit comments