Add some instructions for combining transitive dependencies in add-to-app using plugins#3926
Conversation
…-app using plugins
|
This looks fine to me, but I'm waiting for reviews by the SWEs. |
| version. In this example, the host app requested v2.10.1 and the Flutter | ||
| module plugin requested v2.9.9. | ||
|
|
||
| By default, Gradle v5 will [resolve dependency version conflicts](https://docs.gradle.org/current/userguide/dependency_resolution.html#sub:resolution-strategy) |
There was a problem hiding this comment.
how about gradle v5+? Since not everyone's on 6 and 5 resolves it this way too.
There was a problem hiding this comment.
https://docs.gradle.org/current/userguide/dependency_resolution.html refers to v6, which is the current version/
| module plugin requested v2.9.9. | ||
|
|
||
| By default, Gradle v5 will [resolve dependency version conflicts](https://docs.gradle.org/current/userguide/dependency_resolution.html#sub:resolution-strategy) | ||
| by using the newest version of the library. |
There was a problem hiding this comment.
by using the newest version of the library
It picks the first dependency that shows up in Graph while traversing. :/
There was a problem hiding this comment.
Even they admit that this is bad. "With Maven, this could have unwanted impact on resolved versions.".
There was a problem hiding this comment.
lol is that right?
https://docs.gradle.org/current/userguide/dependency_resolution.html says "Gradle will consider all requested versions, wherever they appear in the dependency graph. Out of these versions, it will select the highest one."
But it's so random I wouldn't be surprised if the implementation did that too.
There was a problem hiding this comment.
I guess even the docs is confusing. It also says:
Apache Maven uses a nearest first strategy.
Maven will take the shortest path to a dependency and use that version. In case there are multiple paths of the same length, the first one wins.
|
|
||
| Some plugins require you to make some edits to the Android side of your project. | ||
|
|
||
| Taking the [firebase_crashlytics plugin](https://pub.dev/packages/firebase_crashlytics) |
There was a problem hiding this comment.
"Taking the firebase_crashlytics plugin as an example." is an awkward sentence, maybe "As an example, the firebase_crashlytics plugin integration instructionsl..."
| Some plugins require you to make some edits to the Android side of your project. | ||
|
|
||
| Taking the [firebase_crashlytics plugin](https://pub.dev/packages/firebase_crashlytics) | ||
| as an example. The plugin's integration instructions requires some manual edits |
There was a problem hiding this comment.
"instructions require manual edits"
| as an example. The plugin's integration instructions requires some manual edits | ||
| to your Android wrapper project's `build.gradle` file. | ||
|
|
||
| In the case of a Flutter module, which only has Dart files, perform those |
There was a problem hiding this comment.
Make these Gradle file edits on the outer, existing Android app rather than in your Flutter module, which only contains dart files.
| By default, Gradle v5 will [resolve dependency version conflicts](https://docs.gradle.org/current/userguide/dependency_resolution.html#sub:resolution-strategy) | ||
| by using the newest version of the library. | ||
|
|
||
| This is generally ok as long as there are no API or implementation breaking |
| application already depends on the same Android library your Flutter module | ||
| does (transitively via a plugin). | ||
|
|
||
| For instance, your existing app's Gradle may already have: |
There was a problem hiding this comment.
@sfshaza2 do you have a preference for "for example" vs "for instance"?
| For Gradle libraries that follow semantic versioning, making sure that your | ||
| existing app and your Flutter module plugin use the same major semantic version | ||
| will help you avoid compile or runtime errors. |
There was a problem hiding this comment.
For Gradle libraries that follow semantic versioning, you can generally avoid compilation and runtime errors by using the same major semantic version in your existing app and Flutter module plugin.
The Android side of #7775.
https://flutter-website-staging-6f2ad.web.app/docs/development/add-to-app/android/plugin-setup