expo: [SDK-46] expo-modules-core CMake errors
Summary
I have 2 repos that use the latest Expo SDK - 46. On both, I’ve been getting CMake errors in the Android Studio terminal when running ‘Refresh Gradle Dependancies’ and a build.
I updated this repo to Expo SDK 46 when it was managed and then prebuilt the app after that.
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
FBJNI_LIB
linked by target "expo-modules-core" in directory /Users/sebsmith/test-cmake/node_modules/expo-modules-core/android
FOLLY_LIB
linked by target "expo-modules-core" in directory /Users/sebsmith/test-cmake/node_modules/expo-modules-core/android
JSEXECUTOR_LIB
linked by target "expo-modules-core" in directory /Users/sebsmith/test-cmake/node_modules/expo-modules-core/android
JSI_LIB
linked by target "expo-modules-core" in directory /Users/sebsmith/test-cmake/node_modules/expo-modules-core/android
REACT_NATIVE_JNI_LIB
linked by target "expo-modules-core" in directory /Users/sebsmith/test-cmake/node_modules/expo-modules-core/android
REACT_NATIVE_MODULES_CORE
linked by target "expo-modules-core" in directory /Users/sebsmith/test-cmake/node_modules/expo-modules-core/android
What platform(s) does this occur on?
Android
Environment
expo-env-info 1.0.5 environment info:
System:
OS: macOS 12.5
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 14.19.2 - ~/.nvm/versions/node/v14.19.2/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v14.19.2/bin/yarn
npm: 6.14.17 - ~/.nvm/versions/node/v14.19.2/bin/npm
Watchman: 2022.07.04.00 - /usr/local/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
IDEs:
Android Studio: Chipmunk 2021.2.1 Patch 2 Chipmunk 2021.2.1 Patch 2
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
npmPackages:
expo: ~46.0.7 => 46.0.7
react: 18.0.0 => 18.0.0
react-dom: 18.0.0 => 18.0.0
react-native: 0.69.4 => 0.69.4
react-native-web: ~0.18.7 => 0.18.7
npmGlobalPackages:
eas-cli: 0.57.0
expo-cli: 6.0.1
Expo Workflow: bare
Minimal reproducible example
npx create-expo-app test-cmake
cd test-cmake
rm yarn.lock
npm install
expo install
npx expo prebuild
Open Android directory in Android Studio then refresh gradle dependancies then the error should appear in the console.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 12
- Comments: 32 (1 by maintainers)
Had a similar issue relating to the CMake file within expo-modules-core recently after upgrading the gradle version.
To fix it I:
Went to SDK Manager within Android Studio, then in SDK tools, check CMake then Apply (if it isn’t already), otherwise uncheck then apply and finally check and apply again (This should ensure you’re on the latest version).
Then within the expo-modules-core build.gradle file, remove this block of code:
I believe issues with CMake may be occuring because it’s defaulting to an older version of CMake due to the block of code above.
I had this same issue in my own project and when I opened Android Studio, it recommended upgrading Gradle Plugin from 7.1.1 to 7.2.2. After doing that,
Make Project
andRun 'app'
worked fine.I tried doing the same with the minimal reproducible example above, first getting the CMake errors, then upgrading Gradle Plugin to 7.2.2, and I was able to
Make Project
without an issue.So I guess the question is … how do we upgrade Gradle Plugin to 7.2.2 in a config plugin or some sticky way so that EAS builds don’t fail?
Edit: interestingly enough, the eas build went through without an issue 🤷♂️
I’m also seeing this:
I’m experiencing the same issue with a bare RN app with expo-modules-core and expo-av throwing this error when syncing gradle
That’s all. I got this error and solved it by clearing the Android Studio cache, also additionally android:
./gradlew clean
andrm -r $HOME/.gradle/caches/
The workaround that works for me:
npx expo prebuild
Strangely, trying Build } Make Project without first closing Android Studio doesn’t work. I also tried upgrading the Gradle plugin, and deleting
~/.gradle/caches/
, but nothing worked until closing and re-opening Android Studio.@evgenyshenets91 this worked for me, thanks
Tried this today. Same issue. I see only one solution create a new project with react native CLI and copy-paste js files from the expo project.
Did you add some specific code here for running expo 0.46.10 + react-native 0.70.3? For me it doesn’t work for android
works with: “expo”: “46.0.10”, “react-native”: “0.70.3”
Bare project I started experiencing this same issue when upgrading
expo-av
from11.2.3
to the current latest:12.0.4
.Versions
Error