我将flutter项目从Windows PC移到Mac。我遇到此错误,我也尝试将其清除干净,但无法解决。运行flutter create时出错。
could not determine the dependencies of task app complieflutterbuilddebugarm flutter
java.net.URISytaxSException Illegal character in opaque part at index 2:c:\\User\\username\\Androidstudioprojects\\appname\\lib\\main.dart
当我在Window pc上创建简单的默认项目并将其移至Mac时,它可以正常工作,但我的大项目无法移动。
FAILURE: Build failed with an exception.
* Where:
Script '/Users/admin/Desktop/fluttersdk/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 875
* What went wrong:
Could not determine the dependencies of task ':app:compileFlutterBuildDebugArm'.
> java.net.URISyntaxException: Illegal character in opaque part at index 2: C:\\Users\\Waqas\\AndroidStudioProjects\\Naija\\lib\\main.dart
* 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 45s
Finished with error: Gradle task assembleDebug failed with exit code 1
我在运行flutter create之后得到了这个
admin@mac-mini Naija 2 % flutter create
Warning! The 'flutter' tool you are currently running is from a different Flutter repository than the one last used by this package. The repository from which the 'flutter' tool is
currently executing will be used instead.
running Flutter tool: /Users/admin/Desktop/flutter
previous reference : /Users/admin/Desktop/fluttersdk/flutter
This can happen when you have multiple copies of flutter installed. Please check your system path to verify that you are running the expected version (run 'flutter --version' to see
which flutter is on your path).
No option specified for the output directory.
Create a new Flutter project.
If run on a project that already exists, this will repair the project, recreating any files that are missing.
Usage: flutter create <output directory>
-h, --help Print this usage information.
--[no-]pub Whether to run "flutter pub get" after the project has been created.
(defaults to on)
--[no-]offline When "flutter pub get" is run by the create command, this indicates whether to run it in offline mode or not. In offline mode, it will need to have all
dependencies already available in the pub cache to succeed.
--[no-]with-driver-test Also add a flutter_driver dependency and generate a sample 'flutter drive' test.
-t, --template=<type> Specify the type of project to create.
[app] (default) Generate a Flutter application.
[package] Generate a shareable Flutter project containing modular Dart code.
[plugin] Generate a shareable Flutter project containing an API in Dart code with a platform-specific implementation for Android, for iOS code, or for both.
-s, --sample=<id> Specifies the Flutter code sample to use as the main.dart for an application. Implies --template=app. The value should be the sample ID of the desired
sample from the API documentation website (http://docs.flutter.dev). An example can be found at
https://master-api.flutter.dev/flutter/widgets/SingleChildScrollView-class.html
--list-samples=<path> Specifies a JSON output file for a listing of Flutter code samples that can created with --sample.
--[no-]overwrite When performing operations, overwrite existing files.
--description The description to use for your new Flutter project. This string ends up in the pubspec.yaml file.
(defaults to "A new Flutter project.")
--org The organization responsible for your new Flutter project, in reverse domain name notation. This string is used in Java package names and as prefix in the
iOS bundle identifier.
(defaults to "com.example")
--project-name The project name for this new Flutter project. This must be a valid dart package name.
-i, --ios-language [objc, swift (default)]
-a, --android-language [java, kotlin (default)]
--[no-]androidx Generate a project using the AndroidX support libraries
答案 0 :(得分:1)
在命令行中删除.packages
并执行flutter pub get
。
答案 1 :(得分:0)
请勿复制您的.flutter-plugins文件 并确保运行
flutter clean
和
flutter packages get
最后,如果以上未提及,您可以在同一项目文件夹中尝试
flutter create