Skip to content

Migrate existing android/settings.gradle to the new file. #54566

Description

@blasten

android/settings.gradle will be changed after #54407 is merged:

include ':app'

-def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
+def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
+def properties = new Properties()

-def plugins = new Properties()
-def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
-if (pluginsFile.exists()) {
-    pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
-}
+assert localPropertiesFile.exists()
+localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }

-plugins.each { name, path ->
-    def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
-    include ":$name"
-    project(":$name").projectDir = pluginDirectory
-}
+def flutterSdkPath = properties.getProperty("flutter.sdk")
+assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
+apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"

This could be handled by flutter migrate in #40460.

Activity

  1. added this to the milestone on Apr 11, 2020
  2. added
    a: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)
    toolAffects the "flutter" command-line tool. See also t: labels.
    on Apr 13, 2020
  3. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  4. removed this from the milestone on Aug 17, 2020
  5. Gustl22 commented on Oct 27, 2023

    @Gustl22
    Contributor

    As migration by the tool is not planned we might need to upgrade it manually by prompting the user: https://github.com/Gustl22/flutter/tree/54566-settings-gradle-migration

    It also would make sense to propose upgrading directly to #135392

  6. Gustl22 commented on Dec 21, 2023

    @Gustl22
    Contributor

    This issue may is obsolete due to #135392 which covers this case. I doubt someone will implement another migration (than the manual docs), if we also don't plan to do this for more recent versions of settings.gradle.

  7. jmagman commented on Dec 21, 2023

    @jmagman
    Member

    @reidbaker can this be closed then?

  8. bartekpacia commented on Jan 9, 2024

    @bartekpacia
    Member

    I agree with @Gustl22, writing a migration tool to automatically migrate .gradle files in infeasible since these files basically contain executable code.

    Such a tool would only work for the most basic apps that didn't edit their Android buildfiles.

  9. github-actions commented on Jan 24, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)team-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions