Closed 8bitter closed 3 years ago
I think you may forget to reference your release keystore in the android project, see signing the app.
bundle Build the Flutter assets directory from your app.
[ +3 ms] Target release_flutter_bundle failed: IconTreeShakerException:
Expected to find
kernel file at
/Users/dhs/Documents/NCFlutter/bug_81954/.dart_tool/flutter_build/c2a3b3712c4a9f
dc1e8045472f13100a/app.dill, but no file found.
To disable icon tree shaking, pass --no-tree-shake-icons to the
requested
flutter build command
Verified this on latest stable and master and I see the same exception in profile
and release
mode, while it works in debug
mode.
We aren't trying to build for Android. We are using a separate Flutter engine running on a different platform. We just need the bundle files.
On Wed, May 5, 2021 at 11:02 PM Frank Pang @.***> wrote:
I think you may forget to reference your release keystore in the android project, see signing the app https://flutter.dev/docs/deployment/android#signing-the-app.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/flutter/flutter/issues/81954#issuecomment-833250746, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXXJY46TXKN44QUGNJMVYDTMIWIPANCNFSM44GGV7HA .
The flutter assemble
equivalent from flutter build apk --release -v
has flags -Pverbose=true -Ptarget-platform=android-arm,android-arm64,android-x64 -Ptarget=lib/main.dart -Pdart-obfuscation=false -Ptrack-widget-creation=true -Ptree-shake-icons=true assembleRelease
flutter build bundle --release --no-tree-shake-icons
succeeded.
@jonahwilliams says flutter build bundle
doesn't generate a dill, just the assets, so there's nothing for the icon tree shaker to run on. We should remove it the flag for that command (probably not actually remove since that would break --no-tree-shake-icons
, but default it to off and hide it).
In the meantime, the workaround is to run flutter build bundle --release --no-tree-shake-icons
.
Here's a session that is building DEBUG version of the bundle. Take note of the bundle/flutter_assets/ directory contents after building, i.e. the vm_snapshot_data, isolate_snapshot_data and kernel_blob.bin files:
✔ ~/src/flutter_counter
21:10 $ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.6, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.1)
[✓] Connected device (2 available)
! Doctor found issues in 1 category.
✔ ~/src/flutter_counter
21:10 $ flutter clean
Deleting build... 4ms
Deleting .dart_tool... 0ms
Deleting .packages... 0ms
Deleting Generated.xcconfig... 0ms
Deleting flutter_export_environment.sh... 0ms
✔ ~/src/flutter_counter
21:10 $ flutter build bundle --debug
Running "flutter pub get" in flutter_counter... 463ms
💪 Building with sound null safety 💪
✔ ~/src/flutter_counter
21:10 $ ls -l build/flutter_assets/
total 37800
-rw-rw-r-- 1 kkiyohara kkiyohara 109 May 17 21:10 AssetManifest.json
-rw-rw-r-- 1 kkiyohara kkiyohara 208 May 17 21:10 FontManifest.json
drwxrwxr-x 2 kkiyohara kkiyohara 4096 May 17 21:10 fonts
-rw-rw-r-- 1 kkiyohara kkiyohara 4075041 May 17 21:10 isolate_snapshot_data
-rw-rw-r-- 1 kkiyohara kkiyohara 33844464 May 17 21:10 kernel_blob.bin
-rw-rw-r-- 1 kkiyohara kkiyohara 751388 May 17 21:10 NOTICES
drwxrwxr-x 3 kkiyohara kkiyohara 4096 May 17 21:10 packages
-rw-rw-r-- 1 kkiyohara kkiyohara 11204 May 17 21:10 vm_snapshot_data
✔ ~/src/flutter_counter
21:10 $
Attempting to build a RELEASE bundle ends up with missing files:
✔ ~/src/flutter_counter
21:10 $ flutter clean
Deleting build... 7ms
Deleting .dart_tool... 2ms
Deleting .packages... 0ms
Deleting Generated.xcconfig... 0ms
Deleting flutter_export_environment.sh... 0ms
✔ ~/src/flutter_counter
21:15 $ flutter build bundle --release --no-tree-shake-icons
Running "flutter pub get" in flutter_counter... 443ms
💪 Building with sound null safety 💪
✔ ~/src/flutter_counter
21:16 $ ls -l build/flutter_assets/
total 752
-rw-rw-r-- 1 kkiyohara kkiyohara 109 May 17 21:16 AssetManifest.json
-rw-rw-r-- 1 kkiyohara kkiyohara 208 May 17 21:16 FontManifest.json
drwxrwxr-x 2 kkiyohara kkiyohara 4096 May 17 21:16 fonts
-rw-rw-r-- 1 kkiyohara kkiyohara 751388 May 17 21:16 NOTICES
drwxrwxr-x 3 kkiyohara kkiyohara 4096 May 17 21:16 packages
✔ ~/src/flutter_counter
21:16 $
i.e. the vm_snapshot_data, isolate_snapshot_data and kernel_blob.bin files
Those are present in debug, not release, so that's behaving correctly. That's not related to the icon tree shaking looking for the dill that isn't being output.
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.
Steps to Reproduce
Note that this fails for flutter build bundle --profile too. Attempting to build bundles in release or profile modes also fail on a mac.
Logs
Logs
20:25 $ flutter create flutter_counter Creating project flutter_counter... flutter_counter/.idea/modules.xml (created) flutter_counter/.idea/runConfigurations/main_dart.xml (created) flutter_counter/.idea/workspace.xml (created) flutter_counter/.idea/libraries/Dart_SDK.xml (created) flutter_counter/.idea/libraries/KotlinJavaRuntime.xml (created) flutter_counter/linux/main.cc (created) flutter_counter/linux/my_application.cc (created) flutter_counter/linux/CMakeLists.txt (created) flutter_counter/linux/.gitignore (created) flutter_counter/linux/my_application.h (created) flutter_counter/linux/flutter/CMakeLists.txt (created) flutter_counter/flutter_counter.iml (created) flutter_counter/lib/main.dart (created) flutter_counter/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme (created) flutter_counter/ios/Runner.xcodeproj/project.pbxproj (created) flutter_counter/ios/Runner/AppDelegate.swift (created) flutter_counter/ios/Runner/Runner-Bridging-Header.h (created) flutter_counter/pubspec.yaml (created) flutter_counter/android/gradle/wrapper/gradle-wrapper.properties (created) flutter_counter/android/.gitignore (created) flutter_counter/android/gradle.properties (created) flutter_counter/android/settings.gradle (created) flutter_counter/android/app/src/profile/AndroidManifest.xml (created) flutter_counter/android/app/src/debug/AndroidManifest.xml (created) flutter_counter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png (created) flutter_counter/android/app/src/main/res/values/styles.xml (created) flutter_counter/android/app/src/main/res/drawable/launch_background.xml (created) flutter_counter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png (created) flutter_counter/android/app/src/main/res/values-night/styles.xml (created) flutter_counter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png (created) flutter_counter/android/app/src/main/res/drawable-v21/launch_background.xml (created) flutter_counter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png (created) flutter_counter/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png (created) flutter_counter/android/app/src/main/AndroidManifest.xml (created) flutter_counter/android/build.gradle (created) flutter_counter/android/flutter_counter_android.iml (created) flutter_counter/android/app/src/main/kotlin/com/example/flutter_counter/MainActivity.kt (created) flutter_counter/android/app/build.gradle (created) flutter_counter/README.md (created) flutter_counter/.metadata (created) flutter_counter/test/widget_test.dart (created) flutter_counter/.gitignore (created) flutter_counter/web/icons/Icon-192.png (created) flutter_counter/web/icons/Icon-512.png (created) flutter_counter/web/manifest.json (created) flutter_counter/web/index.html (created) flutter_counter/web/favicon.png (created) flutter_counter/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata (created) flutter_counter/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (created) flutter_counter/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings (created) flutter_counter/ios/.gitignore (created) flutter_counter/ios/Flutter/AppFrameworkInfo.plist (created) flutter_counter/ios/Flutter/Release.xcconfig (created) flutter_counter/ios/Flutter/Debug.xcconfig (created) flutter_counter/ios/Runner/Info.plist (created) flutter_counter/ios/Runner/Base.lproj/LaunchScreen.storyboard (created) flutter_counter/ios/Runner/Base.lproj/Main.storyboard (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png (created) flutter_counter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png (created) flutter_counter/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json (created) flutter_counter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png (created) flutter_counter/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md (created) flutter_counter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png (created) flutter_counter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png (created) flutter_counter/ios/Runner.xcworkspace/contents.xcworkspacedata (created) flutter_counter/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (created) flutter_counter/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings (created) Running "flutter pub get" in flutter_counter... 1,501ms Wrote 84 files. All done! In order to run your application, type: $ cd flutter_counter $ flutter run To enable null safety, type: $ cd flutter_counter $ dart migrate --apply-changes Your application code is in flutter_counter/lib/main.dart. ✔ ~/src 20:25 $ cd flutter_counter ✔ ~/src/flutter_counter 20:26 $ flutter build bundle --verbose --release [ +62 ms] executing: [/home/kkiyohara/src/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H [ +26 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H [ ] 1d9032c7e1d867f071f2277eb1673e8f9b0274e3 [ ] executing: [/home/kkiyohara/src/flutter/] git tag --points-at 1d9032c7e1d867f071f2277eb1673e8f9b0274e3 [ +11 ms] Exit code 0 from: git tag --points-at 1d9032c7e1d867f071f2277eb1673e8f9b0274e3 [ ] 2.0.6 [ +32 ms] executing: [/home/kkiyohara/src/flutter/] git rev-parse --abbrev-ref --symbolic @{u} [ +4 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u} [ ] origin/stable [ ] executing: [/home/kkiyohara/src/flutter/] git ls-remote --get-url origin [ +4 ms] Exit code 0 from: git ls-remote --get-url origin [ ] https://github.com/flutter/flutter.git [ +33 ms] executing: [/home/kkiyohara/src/flutter/] git rev-parse --abbrev-ref HEAD [ +4 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD [ ] stable [ +44 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +36 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update. [ ] Artifact Instance of 'GradleWrapper' is not required, skipping update. [ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ ] Artifact Instance of 'FlutterSdk' is not required, skipping update. [ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update. [ ] Artifact Instance of 'PubDependencies' is not required, skipping update. [ +51 ms] Skipping pub get: version match. [ +100 ms] Generating /home/kkiyohara/src/flutter_counter/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java [ +60 ms] 💪 Building with sound null safety 💪 [ +7 ms] Initializing file store [ +6 ms] release_flutter_bundle: Starting due to {} [ +97 ms] Persisting file store [ +1 ms] Done persisting file store [ +3 ms] Target release_flutter_bundle failed: IconTreeShakerException: Expected to find kernel file at /home/kkiyohara/src/flutter_counter/.dart_tool/flutter_build/303cf5f7e09bb2a84a7f5b70bcf010f9/app.dill, but no file found. To disable icon tree shaking, pass --no-tree-shake-icons to the requested flutter build command [ +10 ms] "flutter bundle" took 391ms. [ +2 ms] Failed to build bundle. [ ] #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) #1 buildWithAssemble (package:flutter_tools/src/bundle.dart:175:5)