'Execution failed for task ':react-native-reanimated:replaceSoTaskDebug'

I recently discovered a subtle bug in my React Native environment. Running on an Apple M1 with Rosetta enabled for iTerm, my android app would crash with the following error

Execution failed for task ':react-native-reanimated:replaceSoTaskDebug'.
> javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

iOS runs fine. No one else on my project has this issue even the other dev with an M1 Macbook. He said he installed brew apps, like yarn and watchman without Rosetta.

So I uninstalled/reinstalled yarn and watchman w/o Rosetta (node wasn't installed with brew). After cleaning yarn and android, and then launching android from CLI, it worked! I was successfully able to run my android app.

I switched git branches to work on something else. I pulled develop into my working branch, cleaned the environment, launched android, and BOOM! the same crash again! What!? I switched back to develop, recleaned the environment and no-go. The app still crashes with the above error. I have no idea what's going on here. If anyone has a clue or if you need more info, please speak up.

System:
    OS: macOS 12.3.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1.52 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.5.0 - /usr/local/bin/npm
    Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      API Levels: 28, 30, 31, 32
      Build Tools: 29.0.2, 29.0.3, 32.0.0, 32.1.0, 33.0.0
      System Images: android-30 | Google APIs ARM 64 v8a, android-30 | Google APIs Intel x86 Atom_64, android-31 | Google APIs ARM 64 v8a, android-32 | Google APIs ARM 64 v8a, android-Tiramisu | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8512546
    Xcode: 13.4/13F17a - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_322 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.14.0 => 16.14.0 
    react-native: 0.64.1 => 0.64.1 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source