Repository navigation
Closed
Closed
Copy link
Labels
P0Critical issues such as a build break or regressionCritical issues such as a build break or regressionc: regressionIt was better in the past than it is nowIt was better in the past than it is nowcp: betacherry pick this pull request to beta release candidate branchcherry pick this pull request to beta release candidate branchcp: stablecherry pick this pull request to stable release candidate branchcherry pick this pull request to stable release candidate branchfound in release: 3.33Found to occur in 3.33Found to occur in 3.33found in release: 3.35Found to occur in 3.35Found to occur in 3.35fyi-toolFor the attention of Flutter Tool teamFor the attention of Flutter Tool teamhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versiont: gradle"flutter build" and "flutter run" on Android"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamOwned by Android platform teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-androidTriaged by Android platform teamTriaged by Android platform team
Description
Steps to reproduce
Add this code to build.gradle.kts:
val abiCodes = mapOf("x86_64" to 1, "armeabi-v7a" to 2, "arm64-v8a" to 3, "universal" to 4)
androidComponents {
onVariants { variant ->
variant.outputs.forEach { output ->
val name = output.filters.find { it.filterType == ABI }?.identifier
val baseAbiCode = abiCodes[name ?: "universal"]
if (baseAbiCode != null) {
output.versionCode.set(output.versionCode.get() * 10000 + baseAbiCode * 1000)
}
}
}
}It works fine in Flutter 3.32.X, but not in 3.35.X. This issue is suspected to be caused by #169816.
Expected results
Version code for each arch:
x86_64- XX1000armeabi-v7a- XX2000arm64-v8a- XX3000universal- XX4000
Since the format XX[version code] is required by F-Droid, I hope there is a solution that can achieve this.
Actual results
Version code for each arch:
x86_64- 40xxarmeabi-v7a- 10XXarm64-v8a- 20XX
Code sample
Same as above.
Screenshots or Video
Logs
Flutter Doctor output
It doesn't matter.
Reacted by linsui, Predidit and lollipopkit🏳️⚧️
Reacted by foss-
Metadata
Metadata
Assignees
Labels
P0Critical issues such as a build break or regressionCritical issues such as a build break or regressionc: regressionIt was better in the past than it is nowIt was better in the past than it is nowcp: betacherry pick this pull request to beta release candidate branchcherry pick this pull request to beta release candidate branchcp: stablecherry pick this pull request to stable release candidate branchcherry pick this pull request to stable release candidate branchfound in release: 3.33Found to occur in 3.33Found to occur in 3.33found in release: 3.35Found to occur in 3.35Found to occur in 3.35fyi-toolFor the attention of Flutter Tool teamFor the attention of Flutter Tool teamhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versiont: gradle"flutter build" and "flutter run" on Android"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamOwned by Android platform teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-androidTriaged by Android platform teamTriaged by Android platform team
Activity
tirth-patel-nc commentedon Aug 18, 2025
@mumu-lhl thanks for the report. I added the snippet in build.gradle.kts (both project and app level) but ran into errors for both 3.32 & 3.35. Could you please share a proper runnable snippet and any missing steps/config so we can verify on our end? Since you confirmed it’s a regression, we’d like to reproduce it correctly.
also please confirm whether #62005 is somewhat related to your case or not.
mumu-lhl commentedon Aug 18, 2025
Here's my build.gralde.kts https://github.com/mumu-lhl/Ciyue/blob/main/android/app/build.gradle.kts
#62005 seems to have a slightly similar problem to this one.
[-][Android] Flutter 3.35.1 cannot customize the version code during compilation.[/-][+][android] flutter 3.35.1 cannot customize version code due to syntax error caused by gradle migration script[/+][-][android] flutter 3.35.1 cannot customize version code due to syntax error caused by gradle migration script[/-][+][Android] Flutter 3.35.1 cannot customize the version code during compilation.[/+]tirth-patel-nc commentedon Aug 19, 2025
@mumu-lhl thanks for the file. The missing part was adding the import, using the correct build command, (
flutter build apk --split-per-abi) and verifying with aapt dump badging. Please include such crucial details in reports.Thanks for the report. Seeing the same behaviour with latest SDK versions.
build.gradle.kts
Output: 3.32.8
Output: 3.35.1, 3.33.0-1.0.pre-1468, 3.36.0-0.1.pre
37 remaining items
mboetger commentedon Sep 8, 2025
@gmackall - this was re-opened. Can you take a look?
gmackall commentedon Sep 8, 2025
Running @adil192 s code snippet on 3.29.3 and on master I see the same outputs:
Indicating this is not a breaking change (though it is different from the broken behavior on 3.32, see #169790). I also see the same outputs on this version for the snippet being used to modify version codes here
Is this different from what you see? (any of @ImranR98 , @rusty-snake , or @adil192 feel free to reply!) If so can you confirm this is not a breaking change but instead a return to #49544? If so feel free to follow up on that issue, and if not let me know what I'm missing
adil192 commentedon Sep 9, 2025
@gmackall Thanks for investigating. I see the same with a minimal example. I looked some more into it and it seems unrelated to Flutter 3.35, but rather in my switch from groovy to kotlin gradle files.
The solution was just to switch back to the older
android.applicationVariantsapi. I tried it before but it didn't work for some reason, but it's working now...gmackall commentedon Sep 10, 2025
@adil192 Glad to hear you see the same.
I'm going to close this again for now based on that. @ImranR98 and @rusty-snake feel free to follow up if you still feel this behavior is broken in comparison to how it functioned on 3.29.
fix for version code
[Android] Fix version code override calculation in FlutterPlugin (flu…
[Android] Fix version code override calculation in FlutterPlugin (flu…
[Android] Fix version code override calculation in FlutterPlugin (flu…
github-actions commentedon Sep 25, 2025
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 -vand a minimal reproduction of the issue.[Android] Fix version code override calculation in FlutterPlugin (flu…
[Android] Fix version code override calculation in FlutterPlugin (#17…