3

I am developing a Flutter app that uses my own fork of a Flutter package called vocsy_epub_viewer (https://github.com/vongrad/vocsy_epub_viewer) as I need to make some changes in it.

I have included the plugin in pubspec.yaml and this part is working well:

dev_dependencies:
  vocsy_epub_viewer:
    path: dependencies/vocsy_epub_viewer

The vocsy_epub_viewer package contains a Flutter plugin acting as a bridge to call some platform specific code - for Android it is using vocsy_epub_viewer_android_folioreader. I have made a fork of this Android package as well (https://github.com/vongrad/vocsy_epub_viewer_android_folioreader) since I need to make changes in it.

In the Flutter package's dependencies/vocsy_epub_viewer/android/build.gradle file, the Android package was referenced as:

dependencies {
    implementation 'com.github.kaushikgodhani:vocsy_epub_viewer_android_folioreader:V3'
}

I however need to make it such that it is referenced from a local folder where it was cloned (./vocsy_epub_viewer_android_folioreader).

The project structure looks as following:

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

I have tried to include it as following:

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
}

But it does not seem to work. I would greatly appreciate if I could get an advice as of how to do this.

EDIT: I have also tried changing the dependencies/vocsy_epub_viewer/android/build.gradle as suggested by @Sajjad to:

implementation project(':folioreader')

but got the following error:

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'.
3
  • I hope this will help: stackoverflow.com/a/21038488/10147641 Commented Jan 25, 2023 at 6:52
  • new suggestion :) change file('C:\\Users\\test\\Documents\\Projects\\vocsy_epub_viewer_android_folioreader') with file('C:\\Users\\test\\Documents\\Projects\\vocsy_epub_viewer_android_folioreader\\folioreader') Commented Jan 26, 2023 at 8:19
  • I have tried that and it produced the same error as in the edit Commented Jan 27, 2023 at 9:26

1 Answer 1

1

please check this way.

reference your custom vocsy_epub_viewer_android_folioreader from https://jitpack.io


step 1 : Add it in your flutterRoot > vocsy_epub_viewer > android > build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2. Add the dependency

dependencies {
            implementation 'com.github.vongrad:vocsy_epub_viewer_android_folioreader:master-SNAPSHOT'
    }

Sign up to request clarification or add additional context in comments.

5 Comments

thank you for your suggestion. Is there any way that it would not be referenced from a remote git repo but from a local directory? The reason for it is that I do not want that I need to commit my changes to a git repo during development in order to be able to test it in the Flutter app.
@Adam, so I think you have done 99% of Task, please try below link and say us what is the error , stackoverflow.com/a/46100715/6813907
@Adam For Example, I guess implementation "com.folioreader:folioreader" should change with compile project(path: ': folioreader')
And may be this syntax works implementation project(': folioreader') from original Doc docs.gradle.org/current/userguide/…
Thank you for your suggestions. I have tried to apply your changes but without any success. Please see the updated question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.