i'm trying to add a local library to a flutter plugin project. the library is created directly in the root folder of the flutter project (not in the android folder) So here is the structure: MyFlutterProject:
_ lib
__ flutterPlugin.dart
_ MyLibrary
__ build.gradle
__ setting.gradle
__ src
__ ...
_ Android
__ build.gradle
__ ...
[...]
This is my [android] build.gradle file:
group 'org.example.myproject'
version '1.0'
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}
rootProject.allprojects {
repositories {
google()
jcenter()
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 16
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'InvalidPackage'
}
}
dependencies {
implementation project(':myviewer')
}
And this is my [android] setting.gradle file:
rootProject.name = 'Mywidget'
include ':myviewer'
project(':myviewer').projectDir = new File('../myviewer')
When i try flutter run, here is the error:
flutter run Launching lib/main.dart on Aquaris U2 in debug mode... FAILURE: Build failed with an exception.
Where: Build file '/user/path/dev/FlutterPlugin/myproject/android/build.gradle' line: 37
What went wrong: A problem occurred evaluating project ':mywidget'.
Project with path ':myviewer' could not be found in project ':mywidget'.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 908ms
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done
2,1s Gradle task assembleDebug failed with exit code 1
Any idea on how to make it work?
Thank you