Skip to content

[3.22.0] Android App cannot build anymore on latest stable flutter version #148668

Open
@AlexDochioiu

Description

@AlexDochioiu

Steps to reproduce

After running a build/run command such as:

flutter build apk --release --no-tree-shake-icons

I started getting the following error after switching to stable flutter 3.22.0 (from 3.19.6):

Unhandled exception:
RangeError (offset): Invalid value: Not in inclusive range 0..324: 725
#0      RangeError.checkValueInInterval (dart:core/errors.dart:313)
#1      Source.getLocation (package:kernel/ast.dart:14992)
#2      Component.getLocation (package:kernel/ast.dart:14787)
#3      _getLocationInComponent (package:kernel/ast.dart:15181)
#4      Procedure._getLocationInEnclosingFile (package:kernel/ast.dart:3329)
#5      TreeNode._getLocationInEnclosingFile (package:kernel/ast.dart:207)
#6      TreeNode._getLocationInEnclosingFile (package:kernel/ast.dart:207)
#7      TreeNode._getLocationInEnclosingFile (package:kernel/ast.dart:207)
#8      TreeNode._getLocationInEnclosingFile (package:kernel/ast.dart:207)
#9      TreeNode.location (package:kernel/ast.dart:203)
#10     localFunctionName (package:vm/transformations/type_flow/utils.dart:449)
#11     SummaryCollector.createSummary (package:vm/transformations/type_flow/summary_collector.dart:628)
#12     TypeFlowAnalysis.getSummary (package:vm/transformations/type_flow/analysis.dart:1782)
#13     _DirectInvocation._processFunction (package:vm/transformations/type_flow/analysis.dart:398)
#14     _DirectInvocation.process (package:vm/transformations/type_flow/analysis.dart:287)
#15     _WorkList.processInvocation (package:vm/transformations/type_flow/analysis.dart:1663)
#16     _WorkList.process (package:vm/transformations/type_flow/analysis.dart:1606)
#17     TypeFlowAnalysis.process (package:vm/transformations/type_flow/analysis.dart:1811)
#18     transformComponent (package:vm/transformations/type_flow/transformer.dart:121)
#19     runGlobalTransformations (package:vm/kernel_front_end.dart:589)
#20     compileToKernel (package:vm/kernel_front_end.dart:489)
<asynchronous suspension>
#21     FrontendCompiler.compile (package:frontend_server/frontend_server.dart:639)
<asynchronous suspension>
#22     starter (package:frontend_server/starter.dart:101)
<asynchronous suspension>
#23     main (file:///Volumes/Work/s/w/ir/x/w/sdk/pkg/frontend_server/bin/frontend_server_starter.dart:13)
<asynchronous suspension>

Target kernel_snapshot failed: Exception


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/Users/alexandrudochioiu/.asdf/installs/flutter/3.22.0-stable/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 13s
Running Gradle task 'assembleRelease'...                           14.3s
Gradle task assembleRelease failed with exit code 1

Expected results

App should be able to build/run

Actual results

App fails to build or run on android

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.22.0, on macOS 14.4.1 23E224 darwin-arm64, locale en-GB)
    • Flutter version 3.22.0 on channel stable at /Users/alexandrudochioiu/.asdf/installs/flutter/3.22.0-stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5dcb86f68f (11 days ago), 2024-05-09 07:39:20 -0500
    • Engine revision f6344b75dc
    • Dart version 3.4.0
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/alexandrudochioiu/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/alexandrudochioiu/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

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

[✓] Android Studio (version 2023.1)
    • 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 17.0.7+0-17.0.7b1000.6-10550314)

[✓] IntelliJ IDEA Community Edition (version 2022.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • 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

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

[✓] Connected device (3 available)
    • iPhone 15 Pro (mobile)          • 507C41EC-43C2-499A-BCA3-F0B1E40275AA • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator)
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 14.4.1 23E224 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 124.0.6367.208

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: buildBuilding flutter applications with the toola: releaseChallenges faced when attempting to productionize an appplatform-androidAndroid applications specificallyteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions