Project with path ':expo-modules-core' could not be found in expo module

Viewed 575

I have created an expo module using yarn create expo-module according to the documentation

When I open android folder of the module in Android Studio and run gradle sync, it produces an error:
Project with path ':expo-modules-core' could not be found in root project 'android'

Gradle script uses project(":expo-modules-core"). expo-modules-core is located in node_modules directory, but the expo-module yarn template doesn't connect to it in any way.

React native plugins on the other hand explicitly specify the location of com.facebook.react:react-native inside node_modules in gradle:

repositories {
  maven {
    url("$rootDir/../../node_modules/react-native/android")
  }
}

dependencies {
  implementation "com.facebook.react:react-native:+" // From node_modules
}

The same doesn't work for expo-modules-core because it doesn't contain maven-metadata

So, the question is how to add a dependency to expo-modules-core?

1 Answers

You should link your expo-module to the project using yarn workspaces, after this, you can open the android folder of the workspaces which uses your expo-module as dependency in android studio. The gradle sync will pass and you will see all the expo modules including yours in the project view.

Related