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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This creates a `some/path/my_flutter/` Flutter module project with some Dart
code to get you started and a `.android/` hidden subfolder that wraps up the
module project in an Android library.
(While not required in what follows, if you so desire, you can build that library
using Gradle:
```
$ cd .android/
$ ./gradlew flutter:assembleDebug
```
This results in a `flutter-debug.aar` archive file in
`.android/Flutter/build/outputs/aar/`.)
### Host app requirements
Before attempting to connect your Flutter module project to your host Android app, please ensure that your host Android app declares the following source compatibility within your app's `build.gradle` file, under the `android { }` block, such as:
```gradle
android {
...
//...
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
Expand All
@@ -69,6 +58,80 @@ android {
```
### Make the host app depend on the Flutter module
There are two ways to achieve this:
#### 1. Depend on the Android Archive (AAR)
This allows your team to build the host app without requiring to install the Flutter tool. You can distribute the artifacts from a local or remote repository.
Let's assume you built a Flutter module at `some/path/my_flutter`, then run:
```
$ cd some/path/my_flutter
$ flutter build aar
```
This command creates a [local repository](https://docs.gradle.org/current/userguide/repository_types.html#sub:maven_local), with the following files:
```
build/host/outputs/repo
└── com
└── example
└── my_flutter
└── flutter_release
├── 1.0
│ ├── flutter_release-1.0.aar
│ ├── flutter_release-1.0.aar.md5
│ ├── flutter_release-1.0.aar.sha1
│ ├── flutter_release-1.0.pom
│ ├── flutter_release-1.0.pom.md5
│ └── flutter_release-1.0.pom.sha1
├── maven-metadata.xml
├── maven-metadata.xml.md5
└── maven-metadata.xml.sha1
```
To depend on the AAR, the host app needs to be able to find these files.
To do that, edit `app/build.gradle` in your host app such as it includes