我正在开发一个Flutter应用程序,它使用了我自己的Flutter软件包vocsy_epub_viewer(https://github.com/vongrad/vocsy_epub_viewer)的分支,因为我需要对其进行一些更改。
我已经在pubspec.yaml中引入了插件,并且这部分工作正常:
dev_dependencies:
vocsy_epub_viewer:
path: dependencies/vocsy_epub_viewer
vocsy_epub_viewer
包含一个Flutter插件,作为调用一些平台特定代码的桥梁 - 对于Android,它使用vocsy_epub_viewer_android_folioreader
。我也制作了这个Android包的分支(https://github.com/vongrad/vocsy_epub_viewer_android_folioreader),因为我需要对其进行更改。
在Flutter包的dependencies/vocsy_epub_viewer/android/build.gradle
文件中,引用了Android包:
dependencies {
implementation 'com.github.kaushikgodhani:vocsy_epub_viewer_android_folioreader:V3'
}
但是我需要让它从本地文件夹中引用,因为它是被克隆的(./vocsy_epub_viewer_android_folioreader
)。
项目结构如下:
flutter project root
dependencies
vocsy_epub_viewer
android
settings.gradle
build.gradle
android
settings.gradle
build.gradle
ios
lib
...
vocsy_epub_viewer_android_folioreader <--- this plugin needs to be included within vocsy_epub_viewer/android
folioreader
settings.gradle
build.gradle
settings.gradle
build.gradle
我已经尝试将它包含在以下内容中:
dependencies/vocsy_epub_viewer/android/settings.gradle
include ':folioreader'
project(':folioreader').projectDir = file('C:\\Users\\test\\Documents\\Projects\\vocsy_epub_viewer_android_folioreader')
dependencies/vocsy_epub_viewer/android/build.gradle
dependencies {
implementation "com.folioreader:folioreader" <-- attempt to import the package from a local folder
// implementation 'com.github.kaushikgodhani:vocsy_epub_viewer_android_folioreader:V3' <-- original import
}
但似乎它不起作用。如果我能得到如何做这个的建议,我将非常感激。
编辑:
我也尝试了更改dependencies/vocsy_epub_viewer/android/build.gradle
,如@Sajjad所建议的:
implementation project(':folioreader')
但是遇到了以下错误:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\test\Documents\Projects\waily\dependencies\vocsy_epub_viewer\android\build.gradle' line: 40
* What went wrong:
A problem occurred evaluating project ':vocsy_epub_viewer'.
> Project with path ':folioreader' could not be found in project ':vocsy_epub_viewer'.
file('C:\\Users\\test\\Documents\\Projects\\vocsy_epub_viewer_android_folioreader')
更改为file('C:\\Users\\test\\Documents\\Projects\\vocsy_epub_viewer_android_folioreader\\folioreader')
- Sajjad