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

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

Open
Tracked by #130635
AlexDochioiu opened this issue May 20, 2024 · 12 comments
Open
Tracked by #130635
Labels
a: build Building flutter applications with the tool a: release Challenges faced when attempting to productionize an app P2 Important issues not at the top of the work list platform-android Android applications specifically team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team

Comments

@AlexDochioiu
Copy link

AlexDochioiu commented May 20, 2024

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!
@darshankawar darshankawar added the in triage Presently being triaged by the triage team label May 20, 2024
@darshankawar
Copy link
Member

Thanks for the report @AlexDochioiu
This looks similar to #138898 and #140318 which were fixed but need to check if they made it to stable 3.22.0 or not. Meanwhile, can you check if you get same exception on latest master / beta ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 20, 2024
@AlexDochioiu
Copy link
Author

@darshankawar Thanks for the reply. I think there's not been a beta release newer than this public one? I can try later.

As for master. To me it seems to be fully broken at the moment (I already posted a comment here #148004 (comment) about it)

@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 May 20, 2024
@AlexDochioiu
Copy link
Author

Thanks for the report @AlexDochioiu This looks similar to #138898 and #140318 which were fixed but need to check if they made it to stable 3.22.0 or not. Meanwhile, can you check if you get same exception on latest master / beta ?

The issue seems indeed similar to those two tickets. Worth saying that unlike them:
a) iOS and web builds with no problems ; only Android build fails
b) On Android, I cannot run the app in either of debug/profile/release. And I also cannot generate an apk/appbundle for it.

@AlexDochioiu
Copy link
Author

@darshankawar I can confirm now that both latest stable (3.22.0) and latest beta (3.22.0-0.3.pre) fail with the same error when building/running on Android.

I still cannot try to run on master because it's either currently broken or something weird is happening on my machine: #148701

@darshankawar
Copy link
Member

Thanks for trying @AlexDochioiu. It does seem to be a regression.

I tried the same command in an existing app at my end which built the apk properly so I am unable to replicate it.

Running Gradle task 'assembleRelease'...                           90.4s
✓ Built build/app/outputs/flutter-apk/app-release.apk (22.7MB)
dhs@Dhss-MacBook-Pro app_foo_stable % 

Is there a way for you to provide us a narrowed down reproducible code sample that triggers the reported error ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 21, 2024
@AlexDochioiu
Copy link
Author

@darshankawar Not sure I can do that easily. However, I managed to address the issue with my setup causing master channel to not work.

It seems that I can successfully build the android app on master, but not on latest beta or stable.

@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 May 21, 2024
@darshankawar
Copy link
Member

Thanks for the update. I'll keep the issue open and label for team's attention on the reported behavior as I am unable to replicate it.

@darshankawar darshankawar added platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels. a: build Building flutter applications with the tool a: release Challenges faced when attempting to productionize an app team-tool Owned by Flutter Tool team and removed in triage Presently being triaged by the triage team labels May 22, 2024
@mraleph
Copy link
Member

mraleph commented May 22, 2024

cc @alexmarkov @jensjoha We really need to make this code more defensive and dump more information when we get a failure like this.

@urim-thummim
Copy link

faced same issue here

copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue May 28, 2024
In for instance flutter/flutter#148668 we
crash on .location, but don't have anything to go on about why that is.
This CL adds more information (e.g. the url, and - in the particular
crash - it would also have added the name of the procedure it got the
uri from).

If this will actually be enough (once a crash comes in with this info)
to fix the issue, I'm don't know, but it should give us more to go on.

Change-Id: Iceab6f7841380d59aa39f26a728fd8fcad90ffb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368303
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
@BenelliFurtado
Copy link

Same here:

  • stable 3.22.1 ❌
  • beta channel ❌
  • master channel 3.23.0-9.0.pre.3 ✅

@JSBmanD
Copy link

JSBmanD commented Jun 4, 2024

Will it be shipped to the next beta release?

Can you please advise which change I need to cherrypick to fix the issue?

@andrewkolos andrewkolos added P2 Important issues not at the top of the work list triaged-tool Triaged by Flutter Tool team labels Jun 7, 2024
@workerbee22
Copy link

Same issue here ... looks like possibly related to enforcing Java version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: build Building flutter applications with the tool a: release Challenges faced when attempting to productionize an app P2 Important issues not at the top of the work list platform-android Android applications specifically team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team
Projects
None yet
Development

No branches or pull requests

8 participants