When I try to build my app in release mode I run:
flutter build apk --release
And I get the following error:
RangeError (offset): Invalid value: Not in inclusive range 0..2374: 2496
The app works fine in debug mode.
I found a github issue where they said that updating flutter to the latest beta version solved it, but I ran:
flutter channel beta
And
flutter upgrade
And still get the error.
I opened an issue there but havent had an answer yet.
I expect to be able to generate the app bundle for uploading to google play.
This is the log:
RangeError (offset): Invalid value: Not in inclusive range 0..2374:
2496 #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._getLocationInEnclosingFile (package:kernel/ast.dart:207)
#10 TreeNode.location (package:kernel/ast.dart:203) #11 localFunctionName
(package:vm/transformations/type_flow/utils.dart:449) #12
SummaryCollector.createSummary
(package:vm/transformations/type_flow/summary_collector.dart:630) #13
TypeFlowAnalysis.getSummary
(package:vm/transformations/type_flow/analysis.dart:1782) #14
_DirectInvocation._processFunction
(package:vm/transformations/type_flow/analysis.dart:398) #15
_DirectInvocation.process
(package:vm/transformations/type_flow/analysis.dart:287) #16
_WorkList.processInvocation
(package:vm/transformations/type_flow/analysis.dart:1663) #17
_WorkList.process
(package:vm/transformations/type_flow/analysis.dart:1606) #18
TypeFlowAnalysis.process
(package:vm/transformations/type_flow/analysis.dart:1811) #19
transformComponent
(package:vm/transformations/type_flow/transformer.dart:121) #20
runGlobalTransformations (package:vm/kernel_front_end.dart:589) #21
compileToKernel (package:vm/kernel_front_end.dart:489) <asynchronous
suspension> #22 FrontendCompiler.compile
(package:frontend_server/frontend_server.dart:639) <asynchronous
suspension> #23 starter
(package:frontend_server/starter.dart:101) <asynchronous suspension>
#24 main (file:///C:/b/s/w/ir/x/w/sdk/pkg/frontend_server/bin/frontend_server_starter.dart:13)
<asynchronous suspension>
And this is the output of flutter doctor:
[√] Flutter (Channel beta, 3.22.0-0.3.pre, on Microsoft Windows
[Versi¢n 10.0.19045.4291], locale es-CO) • Flutter version
3.22.0-0.3.pre on channel beta at C:srcflutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision
87b652410d (3 weeks ago), 2024-04-23 21:41:18 -0500 • Engine revision
b4bfd45986 • Dart version 3.4.0 (build 3.4.0-282.3.beta) • DevTools
version 2.34.3 [√] Windows Version (Installed version of Windows is version 10 or
higher) [√] Android toolchain – develop for Android devices (Android SDK
version 34.0.0) • Android SDK at
C:UsersAlejandroAppDataLocalAndroidsdk • Platform
android-34-ext8, build-tools 34.0.0 • Java binary at: C:Program
FilesAndroidAndroid Studiojbrbinjava • Java version OpenJDK
Runtime Environment (build 17.0.6+0-b2043.56-10027231) • All Android
licenses accepted. [√] Chrome – develop for the web • Chrome at C:Program
FilesGoogleChromeApplicationchrome.exe [√] Visual Studio – develop Windows apps (Visual Studio Community
2022 17.9.4) • Visual Studio at C:Program FilesMicrosoft Visual
Studio2022Community • Visual Studio Community 2022 version
17.9.34714.143 • Windows 10 SDK version 10.0.22000.0 [√] Android Studio (version 2022.3) • Android Studio at C:Program
FilesAndroidAndroid Studio • 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-b2043.56-10027231) [√] VS Code (version 1.89.1) • VS Code at
C:UsersAlejandroAppDataLocalProgramsMicrosoft VS Code •
Flutter extension version 3.88.0 [√] Connected device (4 available) • SM A226BR (mobile) •
R9WW201HDLA • android-arm64 • Android 13 (API 33) • Windows (desktop)
• windows • windows-x64 • Microsoft Windows [Versi¢n
10.0.19045.4291] • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.202 • Edge (web) • edge •
web-javascript • Microsoft Edge 124.0.2478.105 [√] Network resources • All expected network resources are
available.• No issues found!
2
Answers
I solved the issue by switching to the master channel, not the beta. With: flutter channel master Version 3.22.0-36.0.pre.48
I get it on 3.22.2
RangeError (offset): Invalid value: Not in inclusive range 0..1998: 2276
#0 RangeError.checkValueInInterval (dart:core/errors.dart:313)
#1 Source.getLocation (package:kernel/ast.dart:14992)
#2 Component.getLocation (package:kernel/ast.dart:14787)