13

This might be a duplicate of this question. But it has no answer and I will give some details here.

I have created a module with File->New Module->Android Library inside my Flutter plugin's android project. And now I have a structure like below:

|-my_plugin
  |-android
    |-settings.gradle
    |-build.gradle
    |-mylibrary
      |-build.gradle

/android/settings.gradle:

rootProject.name = 'my_plugin'
include ':mylibrary'

/android/build.gradle:

...
dependencies {
  implementation project(':mylibrary')
}

When I build example plugin project (which is automatically created by Flutter CLI) with flutter build apk or flutter run, I get this error:

Project with path ':mylibrary' could not be found in project ':my_plugin'.

Any suggestions?

4
  • 2
    uuhg, the flutter website is also wrong stating we have to import the project. the flutter plugin development on android studio is broken for sure Commented May 13, 2019 at 2:21
  • 1
    @negative_zero, are you able to use library module in flutter plugin? any update? Commented Oct 11, 2019 at 22:39
  • 1
    @SatyaAttili No, at least I couldn't back then and couldn't find anything useful. I had to copy all the files from the library. I will check it later and update the question if it's fixed or there is something useful. Commented Oct 11, 2019 at 23:38
  • 1
    any update on this? Commented Jan 6, 2020 at 4:56

1 Answer 1

2

For those who are still looking for a solution. You can try this.

Instead of putting the below code in the plugin setting.gradle, place it in example/android/settings.gradle

include ':mylibrary'
Sign up to request clarification or add additional context in comments.

Comments

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.