flutter/packages/flutter_tools
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
..
bin Ensure fx flutter attach can find devices (#36564) 2019-07-21 10:24:04 -07:00
doc Add emulatorID field to devices in daemon (#34794) 2019-06-26 16:39:23 +01:00
gradle Flutter build aar (#36732) 2019-07-23 09:27:42 -07:00
ide_templates/intellij Add actions and keyboard shortcut map support (#33298) 2019-06-04 11:30:24 -07:00
lib Flutter build aar (#36732) 2019-07-23 09:27:42 -07:00
schema Adds support for generating projects that use AndroidX support libraries (#31028) 2019-05-31 18:33:02 -07:00
static Reland support flutter test on platform chrome (#33859) 2019-06-05 15:27:49 -07:00
templates Flutter build aar (#36732) 2019-07-23 09:27:42 -07:00
test Flutter build aar (#36732) 2019-07-23 09:27:42 -07:00
tool Some minor fixes to the tool_coverage tool. (#36570) 2019-07-22 13:02:02 -07:00
analysis_options.yaml refactor context to be implicit-downcast safe (#31622) 2019-04-25 15:51:08 -07:00
BUILD.gn Add missing protobuf dependency (#36394) 2019-07-17 15:45:13 -07:00
build.yaml Reland support flutter test on platform chrome (#33859) 2019-06-05 15:27:49 -07:00
dart_test.yaml use pub run for create test and remove [INFO] logs (#35839) 2019-07-10 08:48:01 -07:00
pubspec.yaml Fix the web builds by reverting version bump of build_modules (#36548) 2019-07-19 09:36:36 -07:00
README.md Slight doc change (#24526) 2018-11-19 09:11:40 -08:00

Flutter Tools

Developer tools for building Flutter applications.

Be sure to follow the instructions on CONTRIBUTING.md to setup.

To run the tests, ensure that no devices are connected, then navigate to flutter_tools and execute:

../../bin/cache/dart-sdk/bin/pub run test