Skip to content

Commit

Permalink
Update for Android Kotlin DSL based projects (flutter#9369)
Browse files Browse the repository at this point in the history
## Presubmit checklist

- [x] This PR doesn’t contain automatically generated corrections
(Grammarly or similar).
- [x] This PR follows the [Google Developer Documentation Style
Guidelines](https://developers.google.com/style) — for example, it
doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person).
- [x] This PR uses [semantic line
breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks)
of 80 characters or fewer.

### Changes
Below settings were tested in Kotlin DSL based Android Projects

1. ``` repositories {
maven(url = "https://storage.googleapis.com/download.flutter.io")
maven(url =
"/Users/shivam/StudioProjects/flutter_module/build/host/outputs/repo")
    }```
 need to be added in `settings.gradle.kts`

ADDED
2. Implementing `profileImplementation` in Kotlin DSL projects

~~**Note**: I still cannot find about `profileImplementation` in DSL.
will find and update soon.~~

---------

Co-authored-by: Anthony Sansone <atsansone@users.noreply.github.com>
Co-authored-by: Brett Morgan <brettmorgan@google.com>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
  • Loading branch information
4 people committed Apr 5, 2024
1 parent db3a322 commit 5aa917b
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/add-to-app/android/project-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,59 @@ dependencyResolutionManagement {
}
}
```
</br>

### Kotlin DSL based Android Project

After an `aar` build of a Kotlin DSL-based Android project,
follow these steps to add the flutter_module.

Include the flutter module as a dependency in
the Android project's `app/build.gradle` file.
<?code-excerpt title="MyApp/app/build.gradle.kts"?>
```gradle
android {
buildTypes {
release {
...
}
debug {
...
}
create("profile") {
initWith(getByName("debug"))
}
}
dependencies {
// ...
debugImplementation "com.example.flutter_module:flutter_debug:1.0"
releaseImplementation 'com.example.flutter_module:flutter_release:1.0'
add("profileImplementation", "com.example.flutter_module:flutter_profile:1.0")
}
```

The `profileImplementation` ID is a custom `configuration` to be
implemented in the `app/build.gradle` file of a host project.

<?code-excerpt title="host-project/app/build.gradle.kts"?>
```gradle
configurations {
getByName("profileImplementation") {
}
}
```

<?code-excerpt title="MyApp/settings.gradle.kts"?>
```gradle
include(":app")
dependencyResolutionManagement {
repositories {
maven(url = "https://storage.googleapis.com/download.flutter.io")
maven(url = "some/path/flutter_module_project/build/host/outputs/repo")
}
}
```

{{site.alert.important}}
Expand Down

0 comments on commit 5aa917b

Please sign in to comment.