Skip to content

Conversation

@flutteractionsbot
Copy link

@flutteractionsbot flutteractionsbot commented Oct 20, 2025

Requesting a review from a release engineer who is not me and a review from the flutter android team that is not me.

Issue Link:

What is the link to the issue this cherry-pick is addressing?
#177037

Changelog Description:

flutter/issue/177037 Allows some android apps that use dynamic modules to build from android studio.

Workaround:

Is there a workaround for this issue?

Do not build in android studio but instead use the command line.

Risk:

What is the risk level of this cherry-pick?
Build change but it is a revert and a removal of a branch of code behind a check for launching from android studio.

  • Low
  • Medium
  • High

Test Coverage:

Are you confident that your fix is well-tested by automated tests?
No tests for this feature as it would have required launching android studio.

  • Yes
  • No

Validation Steps:

What are the steps to validate that this fix works?

Use compileOnly dependencies in an app that also uses dynamic download.

…flutter#167332)" (flutter#177053)

This reverts commit 0c0406a.
Fixes flutter#177037

I am leaving the method for checking if the build was launched from
android studio.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
@flutteractionsbot flutteractionsbot added the cp: review Cherry-picks in the review queue label Oct 20, 2025
@flutteractionsbot flutteractionsbot requested a review from a team as a code owner October 20, 2025 14:29
@flutteractionsbot
Copy link
Author

@reidbaker please fill out the PR description above, afterwards the release team will review this request.

@flutter-dashboard
Copy link

This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter.

Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed.

@github-actions github-actions bot added platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels. labels Oct 20, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request reverts a previous change related to resolving native Flutter dependencies in Android Studio. The modifications remove the maybeAddAndroidStudioNativeConfiguration function and its related helpers, which were responsible for adding compileOnly dependencies. Additionally, a try-catch block surrounding the generateLockfiles task registration in FlutterPlugin.kt is removed.

Comment on lines +328 to 341
rootProject.tasks.register("generateLockfiles") {
doLast {
rootProject.subprojects.forEach { subproject ->
val gradlew: String =
getExecutableNameForPlatform("${rootProject.projectDir}/gradlew")
val execOps = rootProject.serviceOf<ExecOperations>()
execOps.exec {
workingDir(rootProject.projectDir)
executable(gradlew)
args(":${subproject.name}:dependencies", "--write-locks")
}
}
}
} catch (e: TaskInstantiationException) {
// ignored
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This revert removes the try-catch block that was added to prevent a crash when the generateLockfiles task is already registered. This can happen if addTaskForLockfileGeneration is invoked multiple times on the same root project. Reverting this could reintroduce build failures.

A safer way to handle this is to check for the task's existence before registering it, which is better than catching and ignoring an exception.

Consider using findByName to ensure idempotency:

if (rootProject.tasks.findByName("generateLockfiles") == null) {
    rootProject.tasks.register("generateLockfiles") {
        doLast {
            rootProject.subprojects.forEach { subproject ->
                val gradlew: String =
                    getExecutableNameForPlatform("${rootProject.projectDir}/gradlew")
                val execOps = rootProject.serviceOf<ExecOperations>()
                execOps.exec {
                    workingDir(rootProject.projectDir)
                    executable(gradlew)
                    args(":${subproject.name}:dependencies", "--write-locks")
                }
            }
        }
    }
}

@reidbaker reidbaker added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 23, 2025
@auto-submit auto-submit bot merged commit 6c0f1cf into flutter:flutter-3.37-candidate.0 Oct 23, 2025
141 checks passed
@camsim99
Copy link
Contributor

@reidbaker Late catch but this should be to flutter-3.38.candidate.0. Can you make another cherry pick?

auto-submit bot pushed a commit that referenced this pull request Oct 28, 2025
…in Android Studio (#167332)"" (#177601)

Reverts #177255. This pull request was to the wrong branch. Should have been flutter-3.38-candidate.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App cp: review Cherry-picks in the review queue platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants