Android build error on react-native ^0.69.1
After upgrading from 0.68.1 to react-native 0.69.1 I am getting the following error after trying to build on android. Hermes is enabled
> Configure project :react-native-mmkv
MMKV: node_modules/ found at: /Users/user/Documents/project/node_modules
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
6 actionable tasks: 6 up-to-date
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file '/Users/user/Documents/project/node_modules/react-native-mmkv/android/build.gradle' line: 72
* What went wrong:
A problem occurred evaluating project ':react-native-mmkv'.
> react-native-mmkv: React Native android directory (node_modules/react-native/android) does not exist! Resolved node_modules to: /Users/user/Documents/project/node_modules
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':react-native-mmkv'.
> com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 4s
React-native info:
System:
OS: macOS 12.4
CPU: (10) arm64 Apple M1 Pro
Memory: 113.63 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
Yarn: 1.22.18 - ~/.nvm/versions/node/v16.15.0/bin/yarn
npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
Watchman: 2022.05.16.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/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, 29, 30, 31, 32
Build Tools: 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0
System Images: android-32 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 13.4/13F17a - /usr/bin/xcodebuild
Languages:
Java: 11.0.14 - /Users/user/.sdkman/candidates/java/current/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.0.0 => 18.0.0
react-native: 0.69.1 => 0.69.1
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
any update? did you find a workaround?
Any update ? I am also getting similar error in iOS with latest React Native 0.69.4.
I got it fixed with this: #413
@gax97 you encountered this because most likely your android/settings.gradle file is incorrect. Make sure to include Hermes within the if-statement:
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
include(":ReactAndroid")
project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid')
include(":ReactAndroid:hermes-engine")
project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine')
}
Hey! Sorry I cannot reproduce the issue here and it has been inactive for a while. I am going over issues right now and want to keep the repo clean - so I'm closing this for now, if anyone can post a reproduceable example here I can re-open and take a look :)