Closed jsonhu closed 1 year ago
Is it necessary to provide a "ReactNative-library.cmake" in cmake-utils?
@jsonhu did you happen to find out what the solution is here? I seem to have the same problem.
Not sure if this is the same issue, but it may give a hint: When I encountered an error about CMakeList.txt after upgrading to RN 0.71, it turned out I had a dependency that was using an ancient version of react-native-gradle-plugin. When I then added the latest version of react-native-gradle-plugin to the devDependencies of my project the build could succeed.
config prefab=true
in library build gradle just solve my problem
config
prefab=true
in library build gradle just solve my problem
@jsonhu where should prefab=true
be set? I'm facing the same issue
@jsonhu > I just ran into the same issue.
I assume you are setting up a New Architecture RN app, e.g. by following: https://reactnative.dev/docs/next/the-new-architecture/cxx-cxxturbomodules
You must set
# Use this property to enable support to the new architecture.
# This will allow you to use TurboModules and the Fabric render in
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=true
in {pathToYourAwesomeProject}/android/gradle.properties
It is false
by default
I had the same issue only if I do not enable the new architecture. I was also able to reproduce the problem on the sample app with react native 0.73.1.
Issue was resolved as @jsonhu suggested. Added prefab=true
under buildFeatures
config block.
buildFeatures {
prefab=true // add this
}
externalNativeBuild {
cmake {
path "$projectDir/src/main/jni/CMakeLists.txt"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
Description
when I create CMakeLists.txt in the library project, and the content of the CMakeLists.txt as follows:
after that I executed gradle sync and the build failed with the following result:
Could not find a package configuration file provided by "ReactAndroid" with any of the following names:
Add the installation prefix of "ReactAndroid" to CMAKE_PREFIX_PATH or set "ReactAndroid_DIR" to a directory containing one of the above files. If "ReactAndroid" provides a separate development package or SDK, be sure it has been installed.
Version
0.71.1
Output of
npx react-native info
System: OS: macOS 13.1 CPU: (10) arm64 Apple M1 Pro Memory: 167.31 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 19.3.0 - /opt/homebrew/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.2.0 - /opt/homebrew/bin/npm Watchman: 2023.01.02.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: Not Found SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9477386 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 11.0.16.1 - /opt/homebrew/opt/openjdk@11/bin/javac npmPackages: @react-native-community/cli: 10.1.3 => 10.1.3 react: 18.2.0 => 18.2.0 react-native: Not Found react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
Snack, code example, screenshot, or link to a repository