-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding plugin migration page. #3249
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
+6 −3 | src/_assets/css/_bootstrap_config_shared.scss | |
+12 −6 | src/_assets/css/_code_shared.scss | |
+0 −0 | src/_assets/css/_header_shared.scss | |
+0 −0 | src/_assets/css/_sidebar_shared.scss | |
+0 −0 | src/_assets/css/_toc_shared.scss | |
+0 −15 | tool/before-install.sh | |
+1 −0 | tool/deploy.sh | |
+3 −2 | tool/env-set.sh | |
+8 −8 | tool/get-ruby.sh | |
+3 −2 | tool/install.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,17 @@ description: How to fix AndroidX incompatibilities that have been detected by th | |
--- | ||
|
||
{{site.alert.note}} | ||
You might be directed to this page if the framework detects a problem in your | ||
Flutter app involving AndroidX incompatibilities. | ||
You might be directed to this page if the framework detects a | ||
problem in your Flutter app involving AndroidX incompatibilities. | ||
{{site.alert.end}} | ||
|
||
Android code often uses the | ||
[`android.support`]({{site.android-dev}}/topic/libraries/support-library/) | ||
libraries to ensure backwards compatibility. The `android.support` | ||
libraries are deprecated, and replaced with | ||
[AndroidX]({{site.android-dev}}/jetpack/androidx/). | ||
Android code often uses the [`android.support`][] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a few instances of replacing links with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is our convention. The text is far more readable without the inline link. And Travis tells us of broken links. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is Travis a human or a bot? It would nice to have the validation automated since it's almost impossible to review visually. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Travis is a CI tool. We used to use it on flutter/flutter, but now it's Cirrus. Very much a bot. :) . We also run a weekly linkcheck over the site. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, phew. I didn't want a real Travis to be hurt about me not knowing if they were a bot or not. I think bot Travis will get over it. |
||
libraries to ensure backwards compatibility. | ||
The `android.support` libraries are deprecated, | ||
and replaced with [AndroidX][]. | ||
AndroidX has feature parity with the old libraries | ||
with some additional capabilities but, unfortunately, these two sets of | ||
libraries are incompatible. | ||
with some additional capabilities but, unfortunately, | ||
these two sets of libraries are incompatible. | ||
|
||
_Gradle crashes when trying to build an APK that relies on both sets | ||
of libraries._ This page explains how you can workaround this issue. | ||
|
@@ -29,9 +28,10 @@ AndroidX can break a Flutter app at compile time in two ways: | |
2. The app uses both deprecated and AndroidX code at the same time. | ||
|
||
The error messages from Gradle vary. Sometimes the messages mention | ||
"package androidx" or "package android.support" directly. However, often the | ||
Gradle error messages aren't obvious, and instead talk about | ||
"AAPT," "AAPT2," or otherwise mention failing at "parsing resources." | ||
"package androidx" or "package android.support" directly. | ||
However, often the Gradle error messages aren't obvious, | ||
and instead talk about "AAPT," "AAPT2," | ||
or otherwise mention failing at "parsing resources." | ||
|
||
These problems must be fixed by either manually migrating the | ||
code to the same library, or downgrading to versions of the plugins | ||
|
@@ -43,16 +43,14 @@ that still use the original support libraries. | |
It's impossible to fully migrate your app to AndroidX if it's | ||
actively using any plugins that rely on the old support library. | ||
If your app depends on plugins that use the old `android.support` | ||
packages, you'll need to [avoid using AndroidX](#avoiding-androidx). | ||
packages, you'll need to [avoid using AndroidX][]. | ||
{{site.alert.end}} | ||
|
||
First make sure that `compileSdkVersion` is at least `28` in | ||
`app/build.gradle`. This property controls the version of the | ||
Android SDK that Gradle uses to build your APK. It doesn't affect | ||
the minimum SDK version that your app can run on. See the Android | ||
developer docs on [the module-level build | ||
file]({{site.android-dev}}/studio/build/#module-level) | ||
for more information. | ||
developer docs on the [module-level build file][] for more information. | ||
|
||
#### Recommended: Use Android Studio to migrate your app | ||
|
||
|
@@ -61,18 +59,20 @@ Use the following instructions: | |
|
||
1. Import your Flutter app into Android Studio so that the IDE can | ||
parse the Android code following the steps in | ||
[Editing Android code in Android Studio with full IDE | ||
support](/docs/development/tools/android-studio#android-ide). | ||
2. Follow the instructions for [Migrating to | ||
AndroidX]({{site.android-dev}}/jetpack/androidx/migrate). | ||
[Editing Android code in Android Studio with full IDE support][]. | ||
2. Follow the instructions for [Migrating to AndroidX][]. | ||
|
||
#### Not recommended: Manually migrate your app | ||
|
||
See [Migrating to | ||
AndroidX]({{site.android-dev}}/jetpack/androidx/migrate) for more detailed | ||
instructions on how to do this. Below are some steps that you'll likely need to go through as part of this process, listed here for reference. However the specific things you need to do will depend on your build configuration and could differ from the example changes suggested here. | ||
See [Migrating to AndroidX][] for more detailed instructions | ||
on how to do this. Below are some steps that you'll likely | ||
need to go through as part of this process, | ||
listed here for reference. However the specific things | ||
you need to do will depend on your build configuration | ||
and could differ from the example changes suggested here. | ||
|
||
1. In `android/gradle/wrapper/gradle-wrapper.properties` change the line starting with `distributionUrl` like this: | ||
1. In `android/gradle/wrapper/gradle-wrapper.properties`, | ||
change the line starting with `distributionUrl` like this: | ||
|
||
``` | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip | ||
|
@@ -94,7 +94,7 @@ instructions on how to do this. Below are some steps that you'll likely need to | |
} | ||
``` | ||
|
||
3. In `android/gradle.properties`, append | ||
3. In `android/gradle.properties`, append the following: | ||
|
||
``` | ||
android.enableJetifier=true | ||
|
@@ -103,9 +103,12 @@ instructions on how to do this. Below are some steps that you'll likely need to | |
|
||
4. In `android/app/build.gradle`: | ||
|
||
Under `android {`, make sure `compileSdkVersion` and `targetSdkVersion` are at least 28. | ||
Under `android {`, make sure `compileSdkVersion` and | ||
`targetSdkVersion` are at least 28. | ||
|
||
5. Replace all deprecated libraries with the AndroidX equivalents. For instance, if you're using the default `.gradle` files make the following changes: | ||
5. Replace all deprecated libraries with the AndroidX equivalents. | ||
For instance, if you're using the default `.gradle` files | ||
make the following changes: | ||
|
||
In `android/app/build.gradle` | ||
|
||
|
@@ -181,12 +184,11 @@ coming from another plugin besides these. | |
|
||
## For plugin maintainers: Migrating a Flutter plugin to AndroidX | ||
|
||
Migrating a Flutter plugin to AndroidX follows basically the same process as | ||
[migrating a Flutter app](#how-to-migrate-a-flutter-app-to-androidx), | ||
Migrating a Flutter plugin to AndroidX follows basically | ||
the same process as [migrating a Flutter app][], | ||
but with some additional concerns and some slight changes. | ||
|
||
1. Make sure to increment the [major | ||
version]({{site.dart-site}}/tools/pub/versioning#semantic-versions) of | ||
1. Make sure to increment the [major version][] of | ||
your plugin for this change and clearly document it in your plugin's | ||
changelog. This breaking change requires manual migration for | ||
users to fix. Pub treats digits differently depending on whether | ||
|
@@ -198,3 +200,12 @@ but with some additional concerns and some slight changes. | |
IDE as if it's a regular Flutter app. Android Studio also imports and | ||
parses the plugin's Android code. | ||
|
||
|
||
[`android.support`]: {{site.android-dev}}/topic/libraries/support-library/ | ||
[AndroidX]: {{site.android-dev}}/jetpack/androidx/ | ||
[avoid using AndroidX]: #avoiding-androidx | ||
[Editing Android code in Android Studio with full IDE support]: /docs/development/tools/android-studio#android-ide | ||
[major version]: {{site.dart-site}}/tools/pub/versioning#semantic-versions | ||
[Migrating to AndroidX]: {{site.android-dev}}/jetpack/androidx/migrate | ||
[module-level build file]: {{site.android-dev}}/studio/build/#module-level | ||
[migrating a Flutter app]: #how-to-migrate-a-flutter-app-to-androidx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I left some comments here yesterday but I can't find it anymore. It might not have gone through.
I unfortunately have to revert the non-add-to-app changes in this add-to-app branch. Keeping 2 branches is difficult but feasible for purely additive changes. But for changes on existing files like this, it's hard to merge since the base text already changed on master (specifically for this file, it already moved on master). I tried to manually downport some of the non-add-to-app changes back to master but since the base text was so different, I think it's going to be easier to just re-create these changes directly on an up-to-date master.
TL;DR the new plugin-api-migration.md and sidenav.yml will be mergeable to master but the rest will be difficult.