#android #flutter #dart #gradle #sdk
Вопрос:
Недавно я перенес свой проект в новую систему и исправил все ошибки, но получил исключение, в котором говорится, что необходимо предоставить исходный каталог flutter. Я добавил путь к SDK flutter и проверил, но все равно не смог решить проблему.
FAILURE: Build failed with an exception.
* Where:
Script 'C:srcflutterSDKflutterpackagesflutter_toolsgradleflutter.gradle' line: 572
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Could not create task ':app:compileFlutterBuildDebug'.
> Must provide Flutter source directory
* 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.
Я запустил командную команду Flutter doctor, и все в порядке
flutter doctor -v
[√] Flutter (Channel stable, 2.5.0, on Microsoft Windows [Version 10.0.19043.1165], locale en-IN)
• Flutter version 2.5.0 at C:srcflutterSDKflutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4cc385b4b8 (6 days ago), 2021-09-07 23:01:49 -0700
• Engine revision f0826da7ef
• Dart version 2.14.0
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:UsersBarfi NandetiAppDataLocalAndroidsdk
• Platform android-31, build-tools 31.0.0
• Java binary at: C:Program FilesAndroidAndroid Studiojrebinjava
• Java version OpenJDK Runtime Environment (build 11.0.10 0-b96-7249189)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:Program FilesGoogleChromeApplicationchrome.exe
[√] Android Studio (version 2020.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 11.0.10 0-b96-7249189)
[√] VS Code (version 1.60.0)
• VS Code at C:UsersBarfi NandetiAppDataLocalProgramsMicrosoft VS Code
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (2 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.63
• Edge (web) • edge • web-javascript • Microsoft Edge 93.0.961.47
• No issues found!
Ответ №1:
Вероятно, это связано с тем, что пакет SDK flutter находится в другом каталоге, чем ваша старая машина. Проверьте этот ответ.