Unresolved reference: NativeSafeAreaContextSpec with `newArchEnabled=true`
See original GitHub issue> Task :react-native-safe-area-context:compileDebugKotlin FAILED
e: <path>/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextModule.kt: (11, 5): Unresolved reference: NativeSafeAreaContextSpec
e: <path>/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextModule.kt: (12, 3): 'getName' overrides nothing
e: <path>/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextModule.kt: (16, 10): 'getTypedExportedConstants' overrides nothing
e: <path>/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextModule.kt: (21, 21): Unresolved reference: reactApplicationContext
e: <path>/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextPackage.kt: (17, 37): Type mismatch: inferred type is SafeAreaContextModule but NativeModule? was expected
e: <path>/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextPackage.kt: (23, 55): Type mismatch: inferred type is Class<SafeAreaContextModule> but Class<out NativeModule?> was expected
seeing this error during yarn android
suspect that the error is due to the fact that
NativeSafeAreaContextSpec is in src/paper
and build.gradle do not include the paper folder if newArch is enabled
info Fetching system and libraries information...
System:
OS: macOS 12.6
CPU: (10) arm64 Apple M1 Pro
Memory: 478.30 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.15.1 - /private/var/folders/4_/4ngnwlm12y5cghx9sqftw3fw0000gn/T/xfs-92193bd3/node
Yarn: 3.2.3 - /private/var/folders/4_/4ngnwlm12y5cghx9sqftw3fw0000gn/T/xfs-92193bd3/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm
Watchman: 2022.10.03.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /Users/davidhu/.rvm/gems/ruby-3.1.2/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
Android SDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9014738
Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild
Languages:
Java: 18.0.1.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.70.3 => 0.70.3
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
package.json versions
"@react-native-community/art": "1.2.0",
"@react-native-community/async-storage": "1.12.1",
"@react-navigation/native": "6.0.13",
"@react-navigation/native-stack": "6.9.1",
"@tanstack/react-query": "4.9.0",
"react": "18.2.0",
"react-native": "0.70.3",
"react-native-gradle-plugin": "0.71.0",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "3.18.2",
"react-native-svg": "13.2.0",
"react-native-vector-icons": "9.2.0",
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:17
Top Results From Across the Web
Issues · th3rdwave/react-native-safe-area-context - GitHub
Unresolved reference : NativeSafeAreaContextSpec with newArchEnabled=true. #323 opened on Oct 19 by davidhu2000.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
same issue appears while upgrade RN to 0.69 from 0.68
...node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextModule.kt: (11, 5): Unresolved reference: NativeSafeAreaContextSpec...node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextModule.kt: (12, 3): 'getName' overrides nothing...node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextModule.kt: (16, 10): 'getTypedExportedConstants' overrides nothing...node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextModule.kt: (21, 21): Unresolved reference: reactApplicationContext@davidhu2000 @TravellerOnTheRun I finally got it to build. I had to add the following to my
devDependencies, if you use different versions the build fails.I also set a number of env variables, I’m not sure if all of them are necessary however, my build command looked like: