是否可以链接另一个库中具有本机依赖项的库?试图找到手动链接的解决方案,但没有成功。我找到了一个[问题]: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
谢谢。