11

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?

Sait Banazili
  • 1,263
  • 2
  • 12
  • 27
  • 1
    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 – j3g May 13 '19 at 02:21
  • 1
    @negative_zero, are you able to use library module in flutter plugin? any update? – Satya Attili Oct 11 '19 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. – Sait Banazili Oct 11 '19 at 23:38
  • 1
    any update on this? – Panda World Jan 06 '20 at 04:56

1 Answers1

1

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'
Panda World
  • 1,704
  • 1
  • 20
  • 28