Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
89 views
in Technique[技术] by (71.8m points)

android - linking to local module in react native module project

my module project structure is as follows:

  • android/
    • somelibrary/
    • settings.gradle
    • build.gradle
  • ios/
  • src/
  • example/

where example is a simple react native project that uses the module of the root project. somelibrary is a react native module as well, which works fine when imported locally in a react native project. It is linked in the settings.gradle file like this:

include ":somelibrary"
project(":somelibrary").projectDir = file("./somelibrary")

and in the build.gradle file like this:

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        flatDir {
            dirs project(':UnityExport').file('libs')
        }
    }
}

When I build the android part of the project using gradle it works fine as well. However, when I import the module in my example project, I get the following error:

Project with path ':somelibrary' could not be found in project ':mainproject'.
question from:https://stackoverflow.com/questions/65888824/linking-to-local-module-in-react-native-module-project

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...