[SDK-46] expo-modules-core CMake errors

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:8
  • Comments:27 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
trymbillcommented, Aug 25, 2022

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 and Run '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 🤷‍♂️

1reaction
findhumanecommented, Oct 31, 2022

The workaround that works for me:

  1. Run npx expo prebuild
  2. Open Android Studio and the Android project
  3. Wait for the build to fail with the CMake error
  4. Ignore the suggestion to upgrade Gradle
  5. Close Android Studio
  6. Open Android Studio and the project
  7. Click Build } Make Project

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expo SDK 46 throwing CMAKE error when syncing Gradle
This is a temporary solution, but going into your package.json and downgrading expo-modules-core to version 9.2 This gave me a few errors ......
Read more >
Expo SDK 46 CMAKE Error when syncing Gradle - Reddit
I am have managed to replicate this across 3 different repos. I am trying to sync the gradle project in Android studio from...
Read more >
expo-modules-core - npm
Start using expo-modules-core in your project by running `npm i expo-modules-core`. There are 46 other projects in the npm registry using ...
Read more >
expo-modules-core:compiledebugjavawithjavac - You.com
1 error > Task :expo-location:compileDebugJavaWithJavac FAILED FAILURE: Build failed with an ... expo/expo[SDK-46] expo-modules-core CMake errors#18683.
Read more >
Journey to update an outdated ejected Expo React Native ...
Problem: getting “Task: expo-modules-core:configureCMakeDebug[arm64-v8a] FAILED”. It complain about fbjni having no compatible library with ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found