text stringlengths 1 372 |
|---|
<code_end> |
<topic_end> |
<topic_start> |
centralize repository settings |
starting with gradle 7, android recommends using centralized repository |
declarations in settings.gradle instead of project or module level |
declarations in build.gradle files. |
before attempting to connect your flutter module project to your |
host android app, make the following changes. |
remove the repositories block in all of your app’s build.gradle files. |
add the dependencyResolutionManagement displayed in this step to the |
settings.gradle file. |
<topic_end> |
<topic_start> |
add the flutter module as a dependency |
add the flutter module as a dependency of your |
existing app in gradle. you can achieve this in two ways. |
android archive |
the AAR mechanism creates generic android AARs as |
intermediaries that packages your flutter module. |
this is good when your downstream app builders don’t |
want to have the flutter SDK installed. but, |
it adds one more build step if you build frequently. |
module source code |
the source code subproject mechanism is a convenient |
one-click build process, but requires the flutter SDK. |
this is the mechanism used by the android studio IDE plugin. |
<topic_end> |
<topic_start> |
depend on the android archive (aar) |
this option packages your flutter library as a generic local |
maven repository composed of AARs and POMs artifacts. |
this option allows your team to build the host app without |
installing the flutter SDK. you can then distribute the |
artifacts from a local or remote repository. |
let’s assume you built a flutter module at |
some/path/flutter_module, and then run: |
then, follow the on-screen instructions to integrate. |
more specifically, this command creates |
(by default all debug/profile/release modes) |
a local repository, with the following files: |
to depend on the AAR, the host app must be able |
to find these files. |
to do that, edit settings.gradle in your host app |
so that it includes the local repository and the dependency: |
</br> |
<topic_end> |
<topic_start> |
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_start> |
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") |
} |
<code_end> |
the profileImplementation ID is a custom configuration to be |
implemented in the app/build.gradle file of a host project. |
<code_start> |
configurations { |
getByName("profileImplementation") { |
} |
} |
<code_end> |
<code_start> |
include(":app") |
dependencyResolutionManagement { |
repositories { |
maven(url = "https://storage.googleapis.com/download.flutter.io") |
maven(url = "some/path/flutter_module_project/build/host/outputs/repo") |
} |
} |
<code_end> |
error important |
if you’re located in china, use a mirror site rather than the |
storage.googleapis.com domain. to learn more about mirror sites, |
check out using flutter in china page. |
lightbulb tip |
you can also build an AAR for your flutter module in android studio using |
the build > flutter > build AAR menu. |
<topic_end> |
<topic_start> |
depend on the module’s source code |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.