flutter/packages/flutter_tools/templates/plugin
Emmanuel Garcia 242a4225a1
Flutter build aar (#36732)
`flutter build aar`

This new build command works just like `flutter build apk` or `flutter build appbundle`, but for plugin and module projects.

This PR also refactors how plugins are included in app or module projects. By building the plugins as AARs, the Android Gradle plugin is able to use Jetifier to translate support libraries into AndroidX libraries for all the plugin's native code. Thus, reducing the error rate when using AndroidX in apps.

This change also allows to build modules as AARs, so developers can take these artifacts and distribute them along with the native host app without the need of the Flutter tool. This is a requirement for add to app.

`flutter build aar` generates POM artifacts (XML files) which contain metadata about the native dependencies used by the plugin. This allows Gradle to resolve dependencies at the app level. The result of this new build command is a single build/outputs/repo, the local repository that contains all the generated AARs and POM files.

In a Flutter app project, this local repo is used by the Flutter Gradle plugin to resolve the plugin dependencies. In add to app case, the developer needs to configure the local repo and the dependency manually in `build.gradle`:


repositories {
    maven {
        url "<path-to-flutter-module>build/host/outputs/repo"
    }
}

dependencies {
    implementation("<package-name>:flutter_<build-mode>:1.0@aar") {
       transitive = true
    }
}
2019-07-23 09:27:42 -07:00
..
.idea Update idea template files (#24311) 2018-11-14 13:45:07 -08:00
android-java.tmpl Flutter build aar (#36732) 2019-07-23 09:27:42 -07:00
android-kotlin.tmpl Adds support for generating projects that use AndroidX support libraries (#31028) 2019-05-31 18:33:02 -07:00
android.tmpl Flutter build aar (#36732) 2019-07-23 09:27:42 -07:00
ios-objc.tmpl/Classes Add Swift and Kotlin templates (#10259) 2017-05-24 08:22:50 +02:00
ios-swift.tmpl/Classes Animation API improvements (#21540) 2018-09-23 00:43:05 -07:00
ios.tmpl Animation API improvements (#21540) 2018-09-23 00:43:05 -07:00
lib Turn Dart 2 mode by default. (#15565) 2018-03-16 20:29:38 +01:00
test flutter create --template=plugin now include flutter unit test (#26456) 2019-02-12 10:37:00 -08:00
.gitignore.tmpl Do not ignore pubspec.lock in project templates (#24209) 2019-01-09 10:10:38 -08:00
.metadata.tmpl Rename module --> application in flutter create command. (#22565) 2018-10-04 13:03:20 -07:00
CHANGELOG.md.tmpl Update plugin template to comply with new type and style rules (#17840) 2018-05-24 08:49:17 +02:00
LICENSE.tmpl Add --template=<type> option to create command. (#11105) 2017-08-23 13:29:31 +02:00
projectName.iml.tmpl update intellij metadata in template files (#16211) 2018-04-04 09:36:34 -07:00
pubspec.yaml.tmpl Updating dart.dev related links (#32641) 2019-05-14 10:35:00 -07:00
README.md.tmpl Replace flutter.io with flutter.dev (#30562) 2019-04-05 11:39:30 -07:00

# {{projectName}}

{{description}}

## Getting Started

This project is a starting point for a Flutter
[plug-in package](https://flutter.dev/developing-packages/),
a specialized package that includes platform-specific implementation code for
Android and/or iOS.

For help getting started with Flutter, view our 
[online documentation](https://flutter.dev/docs), which offers tutorials, 
samples, guidance on mobile development, and a full API reference.