Repository navigation
when building app bundle with multiple flavorDimension, tool cannot locate .aab file #65264
Description
Activity
- addedteam-infraOwned by Infrastructure teamOwned by Infrastructure team
on Sep 4, 2020 Hi @brightknight08
Can you please try this solution
Thank you- addedin triagePresently being triaged by the triage teamPresently being triaged by the triage teamwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Sep 7, 2020 thank you for pointing me in that direction @TahaTesser . is this the supposed "fix"?
- removedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Sep 9, 2020 Hi @brightknight08
Wanted to make sure if it the same issue or not, if the workaround is working or not, it's for APK but after more testing, APK builds without using that workaround. The issue is only app bundle only..aabfile is generated if you go build but the tool can't locateflutter build apk --release --flavor signedprod
Interestingly, it works with APKYou are building a fat APK that includes binaries for android-arm, android-arm64, android-x64. If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size. To generate an app bundle, run: flutter build appbundle --target-platform android-arm,android-arm64,android-x64 Learn more on: https://developer.android.com/guide/app-bundle To split the APKs per ABI, run: flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configur e-abi-split Removed unused resources: Binary resource data reduced from 46KB to 37KB: Removed 20% Running Gradle task 'assembleSignedprodRelease'... Running Gradle task 'assembleSignedprodRelease'... Done 15.3s ✓ Built build/app/outputs/flutter-apk/app-signedprod-release.apk (15.3MB)
flutter build appbundle --release --flavor signedprod
appbundle_logs.txtflutter doctor -v
[✓] Flutter (Channel stable, 1.20.3, on Mac OS X 10.15.6 19G2021, locale en-GB) • Flutter version 1.20.3 at /Users/tahatesser/Code/flutter_stable • Framework revision 216dee60c0 (8 days ago), 2020-09-01 12:24:47 -0700 • Engine revision d1bc06f032 • Dart version 2.9.2 [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at /Users/tahatesser/Code/sdk • Platform android-30, build-tools 30.0.2 • ANDROID_HOME = /Users/tahatesser/Code/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 11.7) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.7, Build version 11E801a • CocoaPods version 1.9.3 [✓] Android Studio (version 4.0) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 49.0.2 • Dart plugin version 193.7547 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) [✓] VS Code (version 1.48.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.14.1 [!] Connected device ! No devices available ! Doctor found issues in 1 category.flutter doctor -v
[✓] Flutter (Channel master, 1.22.0-10.0.pre.107, on Mac OS X 10.15.6 19G2021, locale en-GB) • Flutter version 1.22.0-10.0.pre.107 at /Users/tahatesser/Code/flutter_master • Framework revision 54ade88365 (4 hours ago), 2020-09-08 22:08:57 -0700 • Engine revision d1d848e842 • Dart version 2.10.0 (build 2.10.0-98.0.dev) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at /Users/tahatesser/Code/sdk • Platform android-30, build-tools 30.0.2 • ANDROID_HOME = /Users/tahatesser/Code/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 11.7) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.7, Build version 11E801a • CocoaPods version 1.9.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.0) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 49.0.2 • Dart plugin version 193.7547 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) [✓] VS Code (version 1.48.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.14.1 [✓] Connected device (3 available) • RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64 • Android 10 (API 29) • Web Server (web) • web-server • web-javascript • Flutter Tools • Chrome (web) • chrome • web-javascript • Google Chrome 85.0.4183.83 • No issues found!- addedfound in release: 1.20Found to occur in 1.20Found to occur in 1.20found in release: 1.22Found to occur in 1.22Found to occur in 1.22has 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 specificallyt: gradle"flutter build" and "flutter run" on Android"flutter build" and "flutter run" on AndroidtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.and removedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Sep 9, 2020 17 remaining items
Leaving another note here, cause I've been struggled for many hours 💩. @PiotrWpl solution was working perfectly fine on my laptop, but not on my project's CI/CD (Github Actions), with a strange log "Skipping task copyAndRenameAab[...] as it has no source files and no previous output files".
@PiotrWpl solution works perfectly on Mac OS and Windows, but not on Ubuntu, as it is a case sensitive OS. So for people having the same issue, you need to add something additional to make it works on all OS. In @PiotrWpl solution,
originalDirPathis always in lower case, you need this to make it with proper case (only changes areproductFlavorsCapitalizedand new value oforiginalDirPath):applicationVariants.all { variant -> variant.outputs.all { def taskSuffix = variant.name.capitalize() def bundleTaskName = "bundle${taskSuffix}" if (tasks.findByName(bundleTaskName)) { def copyAABTask = tasks.create(name: "copyAndRenameAab${taskSuffix}", type: Copy) { def bundleBuildDir = "${buildDir}/outputs/bundle" def flavorsCapitalized = variant.productFlavors.name.withIndex().collect { flavor, index -> index == 0 ? flavor : flavor.capitalize() } def originalDirPath = "${flavorsCapitalized.join()}${variant.buildType.name.capitalize()}" def originalFileName = "${project.archivesBaseName}-${variant.productFlavors.name.join('-')}-${variant.buildType.name}.aab" from "${bundleBuildDir}/${originalDirPath}/${originalFileName}" into "${bundleBuildDir}/${variant.buildType.name}/" rename("${originalFileName}", "app.aab") } tasks[bundleTaskName].finalizedBy = [copyAABTask] } } }
Hope this may help.
Edit : I should have looked more carefully @btrautmann comment…
Reacted by Brandon Trautmann- added a commit that references this issue
on Apr 13, 2023 I can still reproduce this issue with
Master (3.10.0-7.0.pre.17).Logs
# Building appbundle fails issue_65264 ❯ fl build appbundle --flavor signedprod Upgrading build.gradle Running Gradle task 'bundleSignedprodRelease'... Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 1336 bytes (99.9% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app. Running Gradle task 'bundleSignedprodRelease'... 34.0s Gradle build failed to produce an .aab file. It's likely that this file was generated under /Users/nabeelparkar/dev/nevercode/issue_65264/build, but the tool couldn't find it. # Building APK works fine issue_65264 ❯ fl build apk --flavor signedprod Running Gradle task 'assembleSignedprodRelease'... 5.4s ✓ Built build/app/outputs/flutter-apk/app-signedprod-release.apk (17.0MB).
flutter doctor -v(Master)[!] Flutter (Channel master, 3.10.0-7.0.pre.17, on macOS 13.3.1 22E261 darwin-arm64, locale en-US) • Flutter version 3.10.0-7.0.pre.17 on channel master at /Users/nabeelparkar/fvm/versions/master ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.19.5/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nabeelparkar/fvm/versions/master. Consider adding /Users/nabeelparkar/fvm/versions/master/bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision 3ba249a6b3 (77 minutes ago), 2023-04-18 10:46:33 +0530 • Engine revision c4396f9f60 • Dart version 3.1.0 (build 3.1.0-12.0.dev) • DevTools version 2.23.1 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at /Users/nabeelparkar/Library/Android/sdk/ • Platform android-33, build-tools 33.0.2 • ANDROID_SDK_ROOT = /Users/nabeelparkar/Library/Android/sdk/ • Java binary at: /Users/nabeelparkar/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E222b • CocoaPods version 1.12.0 [✓] Chrome - develop for the web • CHROME_EXECUTABLE = /Applications/Brave Browser.app/Contents/MacOS/Brave Browser [✓] Android Studio (version 2022.1) • Android Studio at /Users/nabeelparkar/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9619390/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301) [✓] Android Studio (version 2022.2) • Android Studio at /Users/nabeelparkar/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) [✓] VS Code (version 1.77.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.62.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 13.3.1 22E261 darwin-arm64 • Chrome (web) • chrome • web-javascript • Brave Browser 112.1.50.119 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 1 category.- addedfound in release: 3.7Found to occur in 3.7Found to occur in 3.7found in release: 3.10Found to occur in 3.10Found to occur in 3.10and removedfound in release: 1.20Found to occur in 1.20Found to occur in 1.20found in release: 1.22Found to occur in 1.22Found to occur in 1.22
on Apr 18, 2023 There's some experimentation and discussion on #124797 (thanks @pepompeu!) which I think will be helpful for resolving this issue.
See in particular @andrewkolos's repro recipe at #124797 (comment), and my suggestion at #124797 (comment) to have
--flavortake a comma-separated list of flavors, as influtter build appbundle --flavor someFlavor,someOtherFlavor.Reacted by Andrew KolosReacted by Pedro Pompeu- added a commit that references this issue
on May 19, 2023 - addedr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
on May 20, 2023 - added a commit that references this issue
on May 24, 2023 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.- locked as resolved and limited conversation to collaborators
on Jun 3, 2023

I was having trouble building a flutter app with
2 flavor dimensionsand2 flavorsfor each dimension (total of 4 variants,excluding the debug and release modes).
here's a minimal flutter app repo: https://github.com/brightknight08/flutter_build_appbundle_error to reproduce
when I do
flutter build appbundle --release --flavor signedprod, it would displayflutter doctor -v