问题
Note: I am a beginner in flutter and dart so please make the answers understandable
- When I opened the avd manager and ran the phone, it showed "unable to locate adb" and then opened the phone.
- (It's takes a long time to load)
- When I ran the program in android studio, I got these errors: (also got the same errors in flutter console)
C:\Flutter SDK\flutter\bin\cache\dart-sdk\bin\dart.exe" --enable-asserts --enable-vm-service:58163 C:\Users\user\my_app\lib\main.dart
lib/main.dart: Warning: Interpreting this as package URI, 'package:my_app/main.dart'.
Observatory listening on http://127.0.0.1:58163/ozLrsFGRARk=/
/C:/Flutter%20SDK/flutter/packages/flutter/lib/src/material/animated_icons.dart:9:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui show Paint, Path, Canvas;
^
/C:/Flutter%20SDK/flutter/packages/flutter/lib/src/material/animated_icons.dart:10:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
/C:/Flutter%20SDK/flutter/packages/flutter/lib/src/material/app.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui;
^
/C:/Flutter%20SDK/flutter/packages/flutter/lib/src/material/app_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
/C:/Flutter%20SDK/flutter/packages/flutter/lib/src/material/arc.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
/C:/Flutter%20SDK/flutter/packages/flutter/lib/src/material/bottom_app_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
/C:/Flutter%20SDK/flutter/packages/flutter/lib/src/material/bottom_sheet.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
/C:/Flutter%20SDK/flutter/packages/flutter/lib/src/material/bottom_sheet_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
/C:/Flutter%20SDK/flutter/packages/flutter/lib/src/material/button_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
/C:/Flutter%20SDK/flutter/packages/flutter/lib/src/material/card_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
Process finished with exit code 254
- "system UI is not responding" when the phone loads
Flutter doctor gave me no errors
Nothing appears in the phone
It seems it can't find "dart:ui"?
I don't even know what that is, im following the steps in this book:
https://www.amazon.com/Beginning-App-Development-Flutter-Cross-Platform/dp/1484251806/ref=sr_1_3?dchild=1&keywords=flutter&qid=1593032118&sr=8-3
Also note: I'm new to stackoverflow, this is my first question
Im using the flutter create sample
One more thing, how can I connect my iphone and run the sample on it?
Thank you.
回答1:
Welcome to StackOverflow! These are quite a lot of questions. I hope that I can help you with your problems.
I personally recommend that you test your app on a physical device whenever possible. Virtual devices are also running pretty slow on my system.
dart:ui
is a dart library that contains lots of important stuff. If you opened a flutter project, you need to runflutter pub get
in your console to load all the used libraries into your project."System UI is not responding" is occasionally displayed in Android when the device is running slowly and therefore hangs here and there. I suspect that this is due to the poor performance of the virtual Android device on your PC.
Nothing appears in the phone
Your project could not be compiled and downloaded to the mobile phone due to the errors. Therefore nothing appeared on the display.
im following the steps in this book
You can also have a look at the online examples on the flutter website. I find them very well described and interesting even for beginners. Have a look at: Write your first Flutter app
One more thing, how can I connect my iphone and run the sample on it?
To run your project on your iPhone, you need a Macbook or iMac. I recommend you to work along this article of the flutter online documentation: macOS install (further in this article: Deploy to iOS devices).
Good luck!
回答2:
Create a new virtual device with a different screensize.
来源:https://stackoverflow.com/questions/62564029/errors-in-my-dart-code-and-other-errors-with-android-studio