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

[Flutter 3][Deferred Components] Building an appbundle fails #110101

Open
enricoi opened this issue Aug 23, 2022 · 8 comments
Open

[Flutter 3][Deferred Components] Building an appbundle fails #110101

enricoi opened this issue Aug 23, 2022 · 8 comments
Assignees
Labels
c: crash Stack traces logged to the console dependency: dart Dart team may need to help us found in release: 3.0 Found to occur in 3.0 found in release: 3.1 Found to occur in 3.1 has reproducible steps The issue has been confirmed reproducible and is ready to work on 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

@enricoi
Copy link

enricoi commented Aug 23, 2022

Can't build appbundle with flutter 3. It works without any issue on previous flutter 2.10.5.

It gives me error if I use deferred components and at the same time use even just one of these packages:

- video_player: ^2.4.7
- just_audio: ^0.9.28
- google_sign_in: ^5.4.1
- in_app_review: ^2.0.4
- url_launcher: ^6.1.5

If alternatively I exclude deferred components or these packages build complete successfully.

This is the complete list of other packages that I use without any issue:

  cupertino_icons: ^1.0.2
  flutter_svg: ^1.0.3
  provider: ^6.0.2
  firebase_core: '^1.14.1'
  firebase_auth: ^3.3.14
  firebase_storage: ^10.2.12
  cloud_firestore: ^3.1.12
  cloud_functions: ^3.3.5
  flutter_facebook_auth: ^4.3.0
  font_awesome_flutter: ^10.1.0
  sign_in_with_apple: ^4.1.0
  crypto: ^3.0.1
  in_app_purchase: ^3.0.7
  email_validator: ^2.0.1
  firebase_dynamic_links: ^4.1.3
  flutter_launcher_icons: ^0.10.0
  flutter_inappwebview: ^5.4.3+7
  shared_preferences: ^2.0.13
  carousel_slider: ^4.0.0
  intl: ^0.17.0
  flip_card: ^0.6.0

This is the error on flutter build appbundle:

logs
===== CRASH =====
si_signo=Segmentation fault: 11(11), si_code=1, si_addr=0x1727f5020
version=2.17.6 (stable) (Tue Jul 12 12:54:37 2022 +0200) on "macos_arm"
pid=68563, thread=-1, isolate_group=isolate(0x7ff63380d600), isolate=isolate(0x7ff633813200)
isolate_instructions=0, vm_instructions=0
  pc 0x0000000102d58a8e fp 0x000000030a6cd260 dart::Serializer::RecordDeferredCode(dart::CodePtr)+0x3e
  pc 0x0000000102d68f58 fp 0x000000030a6cd2c0 dart::CodeSerializationCluster::Trace(dart::Serializer*, dart::ObjectPtr)+0x78
  pc 0x0000000102d5aaa1 fp 0x000000030a6cd370 dart::Serializer::Serialize(dart::SerializationRoots*)+0x1a1
  pc 0x0000000102d5e26a fp 0x000000030a6cd5d0 dart::FullSnapshotWriter::WriteProgramSnapshot(dart::ZoneGrowableArray<dart::Object*>*, dart::GrowableArray<dart::LoadingUnitSerializationData*>*)+0xda
  pc 0x0000000102d5e7f7 fp 0x000000030a6cd600 dart::FullSnapshotWriter::WriteFullSnapshot(dart::GrowableArray<dart::LoadingUnitSerializationData*>*)+0x47
  pc 0x0000000103162cb2 fp 0x000000030a6cd900 dart::CreateAppAOTSnapshot(void (*)(void*, unsigned char const*, long), void*, bool, bool, void*, dart::GrowableArray<dart::LoadingUnitSerializationData*>*, dart::LoadingUnitSerializationData*, unsigned int)+0x412
  pc 0x00000001031633ef fp 0x000000030a6cd9e0 dart::Split(void (*)(void*, long, void**, void**), void*, bool, bool, void (*)(void*, unsigned char const*, long), void (*)(void*))+0x39f
  pc 0x0000000103163bf1 fp 0x000000030a6cdab0 Dart_CreateAppAOTSnapshotAsElfs+0x131
  pc 0x0000000102d03642 fp 0x000000030a6cdc50 dart::bin::main(int, char**)+0xf22
  pc 0x000000020391d51e fp 0x000000030a6cdd60 Unknown symbol
-- End of DumpStackTrace

===== CRASH =====
si_signo=Segmentation fault: 11(11), si_code=1, si_addr=0x10ec0c8e0
version=2.17.6 (stable) (Tue Jul 12 12:54:37 2022 +0200) on "macos_x64"
pid=68565, thread=-1, isolate_group=isolate(0x7f95d2008800), isolate=isolate(0x7f95d200c800)
isolate_instructions=0, vm_instructions=0
  pc 0x0000000102a3794e fp 0x0000000309e002b0 dart::Serializer::RecordDeferredCode(dart::CodePtr)+0x3e
  pc 0x0000000102a47496 fp 0x0000000309e00310 dart::CodeSerializationCluster::Trace(dart::Serializer*, dart::ObjectPtr)+0x76
  pc 0x0000000102a397b0 fp 0x0000000309e003c0 dart::Serializer::Serialize(dart::SerializationRoots*)+0x1a0
  pc 0x0000000102a3cfca fp 0x0000000309e00620 dart::FullSnapshotWriter::WriteProgramSnapshot(dart::ZoneGrowableArray<dart::Object*>*, dart::GrowableArray<dart::LoadingUnitSerializationData*>*)+0xda
  pc 0x0000000102a3d557 fp 0x0000000309e00650 dart::FullSnapshotWriter::WriteFullSnapshot(dart::GrowableArray<dart::LoadingUnitSerializationData*>*)+0x47
  pc 0x0000000102e564d2 fp 0x0000000309e00950 dart::CreateAppAOTSnapshot(void (*)(void*, unsigned char const*, long), void*, bool, bool, void*, dart::GrowableArray<dart::LoadingUnitSerializationData*>*, dart::LoadingUnitSerializationData*, unsigned int)+0x412
  pc 0x0000000102e56c0a fp 0x0000000309e00a30 dart::Split(void (*)(void*, long, void**, void**), void*, bool, bool, void (*)(void*, unsigned char const*, long), void (*)(void*))+0x39a
  pc 0x0000000102e573c1 fp 0x0000000309e00b00 Dart_CreateAppAOTSnapshotAsElfs+0x131
  pc 0x00000001029e1072 fp 0x0000000309e00ca0 dart::bin::main(int, char**)+0xf22
  pc 0x000000020337151e fp 0x0000000309e00db0 Unknown symbol
-- End of DumpStackTrace

===== CRASH =====
si_signo=Segmentation fault: 11(11), si_code=1, si_addr=0x10c71c8e0
version=2.17.6 (stable) (Tue Jul 12 12:54:37 2022 +0200) on "macos_simarm64"
pid=68564, thread=-1, isolate_group=isolate(0x7f98ab80dc00), isolate=isolate(0x7f98aa80e800)
isolate_instructions=0, vm_instructions=0
  pc 0x00000001005790ee fp 0x000000030565c2a0 dart::Serializer::RecordDeferredCode(dart::CodePtr)+0x3e
  pc 0x0000000100588c36 fp 0x000000030565c300 dart::CodeSerializationCluster::Trace(dart::Serializer*, dart::ObjectPtr)+0x76
  pc 0x000000010057af50 fp 0x000000030565c3b0 dart::Serializer::Serialize(dart::SerializationRoots*)+0x1a0
  pc 0x000000010057e76a fp 0x000000030565c610 dart::FullSnapshotWriter::WriteProgramSnapshot(dart::ZoneGrowableArray<dart::Object*>*, dart::GrowableArray<dart::LoadingUnitSerializationData*>*)+0xda
  pc 0x000000010057ecf7 fp 0x000000030565c640 dart::FullSnapshotWriter::WriteFullSnapshot(dart::GrowableArray<dart::LoadingUnitSerializationData*>*)+0x47
  pc 0x000000010099bff2 fp 0x000000030565c940 dart::CreateAppAOTSnapshot(void (*)(void*, unsigned char const*, long), void*, bool, bool, void*, dart::GrowableArray<dart::LoadingUnitSerializationData*>*, dart::LoadingUnitSerializationData*, unsigned int)+0x412
  pc 0x000000010099c72a fp 0x000000030565ca20 dart::Split(void (*)(void*, long, void**, void**), void*, bool, bool, void (*)(void*, unsigned char const*, long), void (*)(void*))+0x39a
  pc 0x000000010099cee1 fp 0x000000030565caf0 Dart_CreateAppAOTSnapshotAsElfs+0x131
  pc 0x0000000100522612 fp 0x000000030565cc90 dart::bin::main(int, char**)+0xf22
  pc 0x000000020108e51e fp 0x000000030565cda0 Unknown symbol
-- End of DumpStackTrace
Dart snapshot generator failed with exit code -6
Dart snapshot generator failed with exit code -6
Dart snapshot generator failed with exit code -6


FAILURE: Build failed with an exception.

* Where:
Script '/Users/enricoiurillo/development/sdks/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1156

* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/Users/enricoiurillo/development/sdks/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 23s
flutter doctor -v
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.4 21F79 darwin-arm, locale it-IT)
    • Flutter version 3.0.5 at /Users/enricoiurillo/development/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (6 weeks ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/enricoiurillo/Library/Android/sdk
    • Platform android-32, build-tools 32.0.0
    • ANDROID_HOME = /Users/enricoiurillo/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode 2.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/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.10+0-b96-7249189)

[✓] VS Code (version 1.63.2)
    • Flutter extension version 3.36.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 12.4 21F79 darwin-arm
    • Chrome (web)    • chrome • web-javascript • Google Chrome 104.0.5112.101

[✓] HTTP Host Availability
    • All required HTTP hosts are available
@danagbemava-nc danagbemava-nc added the in triage Presently being triaged by the triage team label Aug 24, 2022
@danagbemava-nc
Copy link
Member

danagbemava-nc commented Aug 24, 2022

Hi @enricoi, thanks for filing the issue.

Please provide the complete log of flutter build appbundle -v that captures the crash you shared above. The output of this may be huge, so kindly put it into a .txt file and attach it here.

Please also provide a complete minimal reproducible code sample.

Thank you

@danagbemava-nc danagbemava-nc added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 24, 2022
@enricoi
Copy link
Author

enricoi commented Aug 24, 2022

Hi @danagbemava-nc,
Here the link to the repository with minimal reproducible code.
I've just used one of the package that cause the issue and add two deferred components with a single image each.

https://github.com/enricoi/build_test

Here the complete log of flutter build appbundle -v
flutter_build_appbundle.txt

Thank you

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 24, 2022
@danagbemava-nc
Copy link
Member

danagbemava-nc commented Aug 25, 2022

I can reproduce the build failing with the sample project linked above.

On stable, with one of the "trouble" dependencies in the pubspec.yaml (video_player in this case), I see a crash that looks like it's coming from dart, similar to what is reported in #110101 (comment).

If I remove the video_player dependency, I get a different crash.

On master, with or without the video_player dependency, I still get a crash. The crash is similar to what I get on stable with the video_player dependency removed.

Interestingly, I cloned flutter_gallery and added all the "trouble" dependencies listed above and after fixing some multidex issues, the build succeeded.

I also attempted to build the same project on flutter 2.10.5, but it also failed to build

Labeling for further investigation from the team.

dependencies I have in flutter_gallery
dependencies:
  adaptive_breakpoints: ^0.1.1
  animations: ^2.0.2
  collection: ^1.16.0
  cupertino_icons: ^1.0.4
  dual_screen: ^1.0.3
  flutter:
    sdk: flutter
  flutter_gallery_assets: ^1.0.2
  flutter_localizations:
    sdk: flutter
  flutter_localized_locales: ^2.0.3
  flutter_staggered_grid_view: ^0.6.1
  google_fonts: ^2.3.2
  google_sign_in: ^5.4.1
  in_app_review: ^2.0.4
  intl: ^0.17.0
  just_audio: ^0.9.28
  meta: ^1.7.0
  package_info_plus: ^1.4.2
  provider: ^6.0.2
  rally_assets: ^3.0.1
  scoped_model: ^2.0.0-nullsafety.0
  shared_preferences: ^2.0.15
  shrine_images: ^2.0.1
  url_launcher: ^6.1.5
  vector_math: ^2.1.2
  video_player: ^2.4.7
logs

gallery.log
master.log
stable_no_video_player.log
stable.log

flutter doctor -v
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.5 21G72 darwin-arm, locale en-GB)
    • Flutter version 3.0.5 at /Users/nexus/dev/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (6 weeks ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/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.12+0-b1504.28-7817840)

[✓] VS Code (version 1.70.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.46.0

[✓] Connected device (3 available)
    • iPhone 13 Pro (mobile) • 6E074BA5-191C-47D4-892F-FD96AFC34148 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.5 21G72 darwin-arm
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 104.0.5112.101

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
[✓] Flutter (Channel master, 3.1.0-0.0.pre.2480, on macOS 12.5 21G72 darwin-arm, locale en-GB)
    • Flutter version 3.1.0-0.0.pre.2480 on channel master at /Users/nexus/dev/sdks/flutters
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a1e8d5d680 (3 hours ago), 2022-08-25 00:23:18 -0400
    • Engine revision 2ad79bea5b
    • Dart version 2.19.0 (build 2.19.0-135.0.dev)
    • DevTools version 2.16.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13F100
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/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.12+0-b1504.28-7817840)

[✓] VS Code (version 1.70.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.46.0

[✓] Connected device (4 available)
    • Nexus (mobile)         • 00008020-001875E83A38002E            • ios            • iOS 15.6.1 19G82
    • iPhone 13 Pro (mobile) • 6E074BA5-191C-47D4-892F-FD96AFC34148 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.5 21G72 darwin-arm
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 104.0.5112.101

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

@danagbemava-nc danagbemava-nc changed the title [Flutter 3] Build appbundle fail in flutter 3 [Flutter 3][Deferred Components]Build appbundle fail in flutter 3 Aug 25, 2022
@danagbemava-nc danagbemava-nc changed the title [Flutter 3][Deferred Components]Build appbundle fail in flutter 3 [Deferred Components] Building an appbundle fails Aug 25, 2022
@danagbemava-nc danagbemava-nc changed the title [Deferred Components] Building an appbundle fails [Flutter 3][Deferred Components] Building an appbundle fails Aug 25, 2022
@danagbemava-nc danagbemava-nc added platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels. t: gradle "flutter build" and "flutter run" on Android has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 3.0 Found to occur in 3.0 found in release: 3.1 Found to occur in 3.1 c: crash Stack traces logged to the console dependency: dart Dart team may need to help us and removed in triage Presently being triaged by the triage team labels Aug 25, 2022
@alexmarkov
Copy link
Contributor

Likely related to the deferred libraries implementation in AOT mode. /cc @rmacnak-google

@rmacnak-google
Copy link
Contributor

The build succeeded for me at tip-of-tree.

Flutter 3.1.0-0.0.pre.2492 • channel unknown • unknown source
Framework • revision db51e5d944 (2 hours ago) • 2022-08-25 12:42:21 -0700
Engine • revision b9ba679200
Tools • Dart 2.19.0 (build 2.19.0-139.0.dev) • DevTools 2.16.0

@stuartmorgan stuartmorgan added the P2 Important issues not at the top of the work list label Aug 30, 2022
@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
@BjoernPetersen
Copy link

The issue was gone for us since Flutter 3.1.0, but showed up again in Flutter 3.13.0.

@a-siva
Copy link
Contributor

a-siva commented Sep 15, 2023

//cc @rmacnak-google looks like we have regression again with deferred loading between Flutter 3.13.0 and 3.1.0

@flutter-triage-bot flutter-triage-bot bot added the Bot is counting down the days until it unassigns the issue label Feb 3, 2024
@flutter-triage-bot
Copy link

This issue is assigned to @rmacnak-google but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

@flutter-triage-bot flutter-triage-bot bot removed the Bot is counting down the days until it unassigns the issue label Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: crash Stack traces logged to the console dependency: dart Dart team may need to help us found in release: 3.0 Found to occur in 3.0 found in release: 3.1 Found to occur in 3.1 has reproducible steps The issue has been confirmed reproducible and is ready to work on 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

No branches or pull requests

8 participants