You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flutter templates should support "com.android.library" Gradle plugin #11632
The generated plugin template build.gradle files, and Flutter's packages/flutter_tools/gradle/flutter.gradle do not support Android library.
In the flutter.gradle file, only project.android.applicationVariants are used. Android library does not have this property and instead offers libraryVariants.
The problem does not happen to app template, such as the example/android in the plugin package.
Fixing this would eliminate all the squiggle lines and missing Flutter imports in Java source.
@postmasters The flutter.gradle script is only intended for building apps. Its role in a plugin project is to build the example app, and thereby to ensure that flutter.jar is available as a provided dependency of the plugin library.
To avoid the squiggle lines in Android Studio, you should import the build.gradle file in the example app (/example/android/build.gradle) rather than opening the /android library directly.
That works but isn't a very intuitive user experience. Why would one want to open an example app to work on the plugin code? Each module should be self contained. It is weird that in order to compile the Android library code, I need to create an app.
Reacted by Łukasz Byjoś, lfkdsk, Rémon, Darel Bitsy, Raoh, Riccardo Ratta, Lars, Santiago, Josip Krnjic, Rostyslav Lesovyi and 13 more
Activity
mit-mit commentedon Aug 16, 2017
cc @mravn-google
mravn-google commentedon Aug 16, 2017
@postmasters The
flutter.gradlescript is only intended for building apps. Its role in a plugin project is to build the example app, and thereby to ensure thatflutter.jaris available as a provided dependency of the plugin library.To avoid the squiggle lines in Android Studio, you should import the
build.gradlefile in the example app (/example/android/build.gradle) rather than opening the/androidlibrary directly.Please let us know if that does not work for you.
postmasters commentedon Aug 18, 2017
That works but isn't a very intuitive user experience. Why would one want to open an example app to work on the plugin code? Each module should be self contained. It is weird that in order to compile the Android library code, I need to create an app.
tolotrasamuel commentedon Mar 19, 2019
How would the change on example will be applied on the actual plugin ?