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

Can't build my app using flutter 3.0 #103571

Closed
YowFung opened this issue May 12, 2022 · 25 comments
Closed

Can't build my app using flutter 3.0 #103571

YowFung opened this issue May 12, 2022 · 25 comments
Labels
r: solved Issue is closed as solved

Comments

@YowFung
Copy link

YowFung commented May 12, 2022

I Can't build my app after I upgrade the flutter SDK to 3.0.

企业微信截图_20220512120938

flutter doctor -v
[√] Flutter (Channel stable, 3.0.0, on Microsoft Windows [版本 10.0.17763.2803], locale zh-CN)
    • Flutter version 3.0.0 at D:\SDK\fvm\current
    • Upstream repository https://github.com/flutter/flutter.git
    • FLUTTER_GIT_URL = https://github.com/flutter/flutter.git
    • Framework revision ee4e09cce0 (2 days ago), 2022-05-09 16:45:18 -0700
    • Engine revision d1b9a6938a
    • Dart version 2.17.0
    • DevTools version 2.12.2
    • Pub download mirror https://pub.flutter-io.cn

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at D:\SDK\Android
    • Platform android-32, build-tools 30.0.3
    • ANDROID_HOME = D:\SDK\Android
    • ANDROID_SDK_ROOT = D:\SDK\Android
    • Java binary at: C:\Program Files\Java\jdk1.8.0_251\bin\java
    • Java version Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • CHROME_EXECUTABLE = C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.11)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.32228.343
    • Windows 10 SDK version 10.0.17763.0

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[√] IntelliJ IDEA Community Edition (version 2021.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.3
    • Flutter plugin version 66.0.2
    • Dart plugin version 212.5744

[√] VS Code (version 1.66.0)
    • VS Code at C:\Users\Zhanghuifeng\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.15.0

[!] Proxy Configuration
    • HTTP_PROXY is set
    • NO_PROXY is localhost,0.0.0.0,127.0.0.1,192.168.1.253,192.168.1.250,192.168.1.251,192.168.1.145,192.168.3.36,192.168.*,169.254.1.1,169.254.*,172.*,10.168.*,*.yowfung.cn,*.yowfung.zos
    • NO_PROXY contains localhost
    ! NO_PROXY does not contain ::1
    • NO_PROXY contains 127.0.0.1

[√] Connected device (4 available)
    • rk3288 (mobile)   • EOLWZ9X3CK • android-arm    • Android 8.1.0 (API 27)
    • Windows (desktop) • windows    • windows-x64    • Microsoft Windows [版本 10.0.17763.2803]
    • Chrome (web)      • chrome     • web-javascript • unknown
    • Edge (web)        • edge       • web-javascript • Microsoft Edge 101.0.1210.39

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

! Doctor found issues in 2 categories.
(venv)
@mgenware
Copy link

@YowFung
Copy link
Author

YowFung commented May 12, 2022

@mgenware I think your link isn't my case. My flutter SDK is upgraded to 3.0 from 2.10. So my code and 3rd party packages are already using null-safety. In addition, my code was no error or warning in IDE after I changed the sdk in pubspec.yaml but it can't be built and run.

@YowFung
Copy link
Author

YowFung commented May 12, 2022

Using Flutter 2.10:
dart_2 16 2

Using Flutter 3.0:
dart_2 17 0

@runkids
Copy link

runkids commented May 12, 2022

Same problem here.

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.0, on macOS 12.3.1 21E258 darwin-arm (Rosetta), locale zh-Hant-TW)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.67.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!

截圖 2022-05-12 下午4 09 58

@ChrisElliotUK
Copy link

@runkids I am having the same issue but have you tried flutter m1 native instead of Rosetta? Could help

@blue492
Copy link

blue492 commented May 12, 2022

Same problem here

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label May 12, 2022
@darshankawar
Copy link
Member

There's similar open issue discussing same errors upon upgrade to 3.0 #103561 so please follow-up in it for further updates and for better tracking.
Closing this as a duplicate.

Mean time, please try this and see if it helps.

@darshankawar darshankawar added r: duplicate Issue is closed as a duplicate of an existing issue and removed in triage Presently being triaged by the triage team labels May 12, 2022
@ChrisElliotUK
Copy link

There's similar open issue discussing same errors upon upgrade to 3.0 #103561 so please follow-up in it for further updates and for better tracking. Closing this as a duplicate.

Mean time, please try this and see if it helps.

dart fix --apply worked for me

@Hixie
Copy link
Contributor

Hixie commented May 12, 2022

I'm going to reopen this issue because #103561 refers to some warnings whereas this issue refers to not being able to build an app at all.

@Hixie Hixie reopened this May 12, 2022
@Hixie
Copy link
Contributor

Hixie commented May 12, 2022

@YowFung Can you post the full logs? In the screenshot you included above there are only warnings, which should be non-fatal and should not be preventing the app from starting.

@lotusprey
Copy link

Yeah, the crash doesn't come from the warnings, but from different third-party packages that are broken on Flutter 3. For me, this happens with the workmanager package. There is also #103648, where it seems that gallery media picker is the problem.

@YowFung
Copy link
Author

YowFung commented May 13, 2022

@Hixie
Sorry, the complete log is so long (738838 chars) and I could not provide it to you. I also could not upload a txt file here. Do you have a better idea?

@YowFung
Copy link
Author

YowFung commented May 13, 2022

Mean time, please try this and see if it helps.

@darshankawar This way is not working for me.

@YowFung
Copy link
Author

YowFung commented May 13, 2022

@Hixie Now I can successfully upload the txt file, the full log is here.

verbose.log

@darshankawar darshankawar added in triage Presently being triaged by the triage team and removed r: duplicate Issue is closed as a duplicate of an existing issue labels May 13, 2022
@darshankawar
Copy link
Member

@YowFung
From the verbose log you shared, the errors seem to be pointing to community plugins:

https://pub.dev/packages/get/install

https://pub.dev/packages/xterm
https://pub.dev/packages/fdottedline_nullsafety/install

https://pub.dev/packages/bitsdojo_window/versions/0.1.1/install

Which might not be compatible with latest 3.0 stable changes, so you may need to reach out to respective plugin owners.

@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 13, 2022
@YowFung
Copy link
Author

YowFung commented May 13, 2022

These are popular plugins but a part of their owners may no longer maintain them or have no time to do it in the short term.
In my opinion, flutter 3.0 should be compatible with older code, isn't 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 13, 2022
@Hixie
Copy link
Contributor

Hixie commented May 13, 2022

Ok the actual problem in those logs is the lines that say "Error":

[+1943 ms] /C:/Users/Zhanghuifeng/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/bitsdojo_window_windows-0.1.0/lib/src/window.dart:2:1: Error: 'Size' is imported from both 'dart:ffi' and 'dart:ui'.
[        ] import 'dart:ui';
[        ] ^^^^
[   +5 ms] /C:/Users/Zhanghuifeng/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/bitsdojo_window_linux-0.1.1/lib/src/window.dart:2:1: Error: 'Size' is imported from both 'dart:ffi' and 'dart:ui'.
[        ] import 'dart:ui';
[        ] ^^^^

Looks like we added Size to dart:ffi and anyone who imports both dart:ffi and dart:ui is going to have an issue. Specifically looks like this is bitsdojo_window_windows and bitsdojo_window_linux.

The solution is to say hide Size on the import 'dart:ffi' line. If the package is no longer maintained and won't accept patches and won't accept someone taking over, I recommend forking it and making the fix locally.

@YowFung
Copy link
Author

YowFung commented May 13, 2022

Both dart:ui and dart:ffi are official libraries. Should officials avoid declaring classes with the same name in multiple libraries?

@darshankawar
Copy link
Member

@YowFung
For WidgetsBinding instance warning logs, please check this link that has various solutions.

@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 13, 2022
@Hixie
Copy link
Contributor

Hixie commented May 13, 2022

Both dart:ui and dart:ffi are official libraries. Should officials avoid declaring classes with the same name in multiple libraries?

There's certainly something to be said for that, yeah. (Though sometimes we do it on purpose, e.g. TextStyle in dart:ui vs package:flutter/painting.dart.)

@bitsdojo
Copy link

If the package is no longer maintained and won't accept patches and won't accept someone taking over, I recommend forking it and making the fix locally.

Thank you for the patch. I will make use of it in the next release as I am back working on the package.

@bitsdojo
Copy link

Fixed in bitsdojo_window: ^0.1.2 - bitsdojo/bitsdojo_window@f320b62 so I think this issue can be closed now.

@YowFung YowFung closed this as completed May 19, 2022
@darshankawar darshankawar added r: solved Issue is closed as solved and removed waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds in triage Presently being triaged by the triage team labels May 19, 2022
@blue492
Copy link

blue492 commented May 20, 2022

I cannot build my app, the same errors are still also in Flutter version [3.0.1].

I updated Dart and did dart fix --apply But it didn't help

@urrvesh
Copy link

urrvesh commented May 25, 2022

If you are getting warnings like below

pub-cache/hosted/pub.dartlang.org/flutter_riverpod-1.0.3/lib/src/framework.dart:275:26: Warning: Operand of null-aware operation '!' has type
'SchedulerBinding' which excludes null.

Find the package name from that warning
For Example=> in the above case flutter_riverpod is the library that need to upgrade in pubspec.yaml

Got to that library doc page (https://pub.dev/packages/<package_name>)
and add that latest version to your pubspec.yaml and then flutter pub get packages

@github-actions
Copy link

github-actions bot commented Jun 8, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
r: solved Issue is closed as solved
Projects
None yet
Development

No branches or pull requests

10 participants