Skip to content
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

Android Gradle Sync is time-consuming #110559

Open
Nayuta403 opened this issue Aug 30, 2022 · 8 comments · May be fixed by #147837
Open

Android Gradle Sync is time-consuming #110559

Nayuta403 opened this issue Aug 30, 2022 · 8 comments · May be fixed by #147837
Labels
c: performance Relates to speed or footprint issues (see "perf:" labels) c: regression It was better in the past than it is now customer: bytedance P2 Important issues not at the top of the work list platform-android Android applications specifically t: gradle "flutter build" and "flutter run" on Android team-android Owned by Android platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-android Triaged by Android platform team

Comments

@Nayuta403
Copy link
Member

Nayuta403 commented Aug 30, 2022

In our multiple projects upgrading from 2.0 to 2.10, we found that Android Gradle increased significantly. Some projects went from 10s to 5 minutes.

The discovery was introduced by this change: #83067. The generateLockfiles task is introduced, and after we delete the task, the time is back to normal.

So I want to know:

  1. What's the worst thing that could happen if I cancel this task?
  2. Why is this task so time-consuming
@talisk

This comment was marked as off-topic.

@Blankj
Copy link

Blankj commented Aug 30, 2022

The following is normal task of sync on version 2.10.
image

If I delete generateLockfiles, sync task execution is getting faster.
image

I found 2.10 sync task execute many extra dependency task.

@Nayuta403
Copy link
Member Author

cc @christopherfujino

@TahaTesser TahaTesser added tool Affects the "flutter" command-line tool. See also t: labels. t: gradle "flutter build" and "flutter run" on Android labels Sep 16, 2022
@exaby73 exaby73 added in triage Presently being triaged by the triage team platform-android Android applications specifically c: performance Relates to speed or footprint issues (see "perf:" labels) and removed in triage Presently being triaged by the triage team labels Sep 19, 2022
@GaryQian
Copy link
Contributor

Is this time increase only being observed recently or has it been happening since #83067 was introduced?

Also, does this occur on every run or just initial runs, perhaps after dependency changes?

  1. Removing this task just disables dep locking, which means as packages upgrade, it might introduce breaking changes. In the short term, removing this task should not make much difference to your app.
  2. We need to look into this further.

@GaryQian GaryQian added the P2 Important issues not at the top of the work list label Sep 20, 2022
@Nayuta403
Copy link
Member Author

@GaryQian Thank you for response

Is this time increase only being observed recently or has it been happening since #83067 was introduced?

Yes, especially when we remove generateLockfiles task, this problem does not exist.

Removing this task just disables dep locking, which means as packages upgrade, it might introduce breaking changes.

Sorry, can you explain it in more detail? Will this cause my compilation to fail?

We need to look into this further.

Yeah, thanks

@GaryQian GaryQian added the c: regression It was better in the past than it is now label Sep 30, 2022
@GaryQian
Copy link
Contributor

Sorry, can you explain it in more detail? Will this cause my compilation to fail?

No, not in the short term. In the future, you may have to fix your project as dependencies update. See https://docs.gradle.org/current/userguide/dependency_locking.html

Perhaps we don't have to call gradlew {subproject}:dependencies --write-locks on every build as this step generates artifacts that can be reused in the future.

@taibaiyinxing
Copy link

@GaryQian As this link said, there are two options to lock all configurations, can we use the second option instead of the first?

@reidbaker
Copy link
Contributor

#112723 has a draft pr but tests fail. This might be a good starting point if someone wanted to take it over.

@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-android Owned by Android platform team triaged-android Triaged by Android platform team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: performance Relates to speed or footprint issues (see "perf:" labels) c: regression It was better in the past than it is now customer: bytedance P2 Important issues not at the top of the work list platform-android Android applications specifically t: gradle "flutter build" and "flutter run" on Android team-android Owned by Android platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-android Triaged by Android platform team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants