反应本机将一个库链接到另一个库内部

时间:2019-04-16 12:48:29

标签: react-native react-native-android react-native-linking

是否可以链接另一个库中具有本机依赖项的库?试图找到手动链接的解决方案,但没有成功。我找到了一个[问题]:Using React-Native library inside another React-Native library的摘要,说不可能将一个库添加/链接到另一个库。 有没有手动方法可以做到这一点?

[编辑]

尝试将react-native-spring-scrollview: ^2.0.20库添加到我的库react-native-demolibrary中,该库是使用react-native-create-library命令创建的库,因为它是一个没有settings.gradle文件的库。因此创建并尝试将库手动链接到react-native-somelibrary

  

settings.gradle

include ':react-native-spring-scrollview'
project(':react-native-spring-scrollview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-spring-scrollview/android')
  

build.gradle

implementation project(':react-native-spring-scrollview')

出现以下错误

  

GRADLE CONSOLE ERROR

org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Build file 'E:\Workspace\DemoApp\node_modules\react-native-demolibrary\android\build.gradle' line: 37
A problem occurred evaluating project ':react-native-library'.
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:139)
    at org.gradle.initialization.DefaultGradleLauncher.getConfiguredBuild(DefaultGradleLauncher.java:104)
    at .....more
  

错误:

Project with path ':react-native-spring-scrollview' could not be found in project ':react-native-demolibrary'.
    Open File

谢谢。

0 个答案:

没有答案