Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Migrate template to Gradle 6.7 and AGP 4.1.0 #70808
Conversation
|
@blasten latest available versions right now are |
| lintOptions { | ||
| disable 'InvalidPackage' | ||
| } | ||
| compileSdkVersion 30 |
xster
Nov 20, 2020
Contributor
this is ok but just for my understanding, this is orthogonal to a agp move right?
| @@ -1,4 +1,3 @@ | |||
| org.gradle.jvmargs=-Xmx1536M | |||
| android.useAndroidX=true | |||
| android.enableJetifier=true | |||
| android.enableR8=true | |||
xster
Nov 20, 2020
Contributor
can you elaborate? Or is this just to save time since no one is shipping it?
blasten
Nov 20, 2020
Author
Contributor
R8 has become the default in this AGP version. Having this causes a warning.
| import io.flutter.plugins.GeneratedPluginRegistrant; | ||
|
|
||
| public class MainActivity extends FlutterActivity { | ||
| @Override | ||
| protected void onCreate(Bundle savedInstanceState) { | ||
| super.onCreate(savedInstanceState); | ||
| GeneratedPluginRegistrant.registerWith(this); | ||
| new MethodChannel(getFlutterView(), "flavor").setMethodCallHandler(new MethodChannel.MethodCallHandler() { |
blasten
Nov 20, 2020
Author
Contributor
it's a small clean up. This isn't used by the test, and was causing some warnings.
|
woohoo! Amazing |
| // This way, custom Proguard rules can be configured as needed. | ||
| proguardFiles project.android.getDefaultProguardFile("proguard-android.txt"), flutterProguardRules, "proguard-rules.pro" | ||
| } | ||
| String flutterProguardRules = Paths.get(flutterRoot.absolutePath, "packages", "flutter_tools", |
xster
Nov 20, 2020
Contributor
is that what the enable r8 thing is? We're just making it unconditional?
blasten
Nov 20, 2020
•
Author
Contributor
This is one is about removing the need to make this conditional via a Flutter tool flag. That isn't needed. Users shouldn't disable this in release, but if they really want, they can always do it in build.gradle.
| String flutterProguardRules = Paths.get(flutterRoot.absolutePath, "packages", "flutter_tools", | ||
| "gradle", "flutter_proguard_rules.pro") | ||
| project.android.buildTypes { | ||
| release { |
xster
Nov 20, 2020
Contributor
when users create custom types, we should document what the right approach is to have the correct default settings associated. e.g. recommend
production {
initWith release
}rather than making one from scratch
blasten
Nov 20, 2020
Author
Contributor
I don't think we are doing anything special, other than profile.
release is an official build type provided by the Android plugin. I think the Flutter docs can link to https://developer.android.com/studio/build/build-variants.
| return target | ||
| } | ||
|
|
||
| // In AGP 4.0, the Android linter task depends on all the JAR tasks containing `libapp.so`. |
| // 3. Otherwise, the equivalent Flutter variant is `release`. | ||
| String variantBuildMode = buildModeFor(libraryVariant.buildType) | ||
| if (buildModeFor(appProjectVariant.buildType) != variantBuildMode) { | ||
| return |
xster
Nov 20, 2020
Contributor
Can we print a message here? I always found the mismatch error a bit cryptic.
blasten
Nov 20, 2020
•
Author
Contributor
This is during configuration phase. It could be quite spammy, and not very meaningful for debugging. What's the user story?
xster
Nov 20, 2020
Contributor
Maybe I'm thinking of something else. In Android Studio, open build variants tab in case of gradle subproject integration, pick one variant for the app and another variant for the flutter module.
| 'To learn more, see: https://developer.android.com/studio/build/shrink-code', | ||
| ); | ||
| hide: true, | ||
| help: 'This flag is deprecated.' |
| @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME | |||
| distributionPath=wrapper/dists | |||
| zipStoreBase=GRADLE_USER_HOME | |||
| zipStorePath=wrapper/dists | |||
| distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip | |||
| distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip | |||
xster
Nov 20, 2020
Contributor
can we add another test to make sure the whole thing builds with gradle 5 / agp 3?
blasten
Nov 20, 2020
Author
Contributor
https://github.com/flutter/tests/tree/master/registry - Although, it looks like we don't build apk in any of those. I will add one that does it.
blasten
Nov 20, 2020
Author
Contributor
Filed #70964. Gradle 5.* is currently tested by building the Flutter Gallery demo app.
|
@csells could be worth calling this out on the next stable blog |
|
LGTM |
8e73bab
into
flutter:master
|
This broke flutter/plugins, see: https://cirrus-ci.com/task/6538283054268416
|
|
So instead of fiximg the boken plugin https://cirrus-ci.com/task/6538283054268416 , you revert this?! |
|
@gustav3d per https://github.com/flutter/flutter/wiki/Tree-hygiene if a commit breaks a tree it should be first reverted, no questions asked, then it should be re-landed with the issue figured. |


Description
Makes the plugin and the tool compatible with the latest release of AGP version, and Gradle.
Migrates the template files for apps, plugins and modules.
Migrates files in the Flutter repo.
Related Issues
Fixes #58247
Fixes #49438
Tests
I added the following tests: unit & e2e tests
Checklist
Before you create this PR, confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.