直接编译运行Flutter项目是没问题的,但是单独打开Android项目进行编译却报错了。
Multiple build operations failed. Could not create task ':path_provider_android:generateDebugUnitTestConfig'. Could not create task ':shared_preferences_android:generateDebugUnitTestConfig'. Could not create task ':url_launcher_android:generateDebugUnitTestConfig'. Could not create task ':video_player_android:generateDebugUnitTestConfig'. Could not create task ':path_provider_android:generateDebugUnitTestConfig'. this and base files have different roots: D:\XXXXXX\build\path_provider_android and C:\Users\xxxx\AppData\Local\Pub\Cache\hosted\pub.dev\path_provider_android-2.2.10\android.
解决方法是:
- 运行
flutter clean
- 在不执行
flutter pub get
的前提下,立即去执行Gradle sync - 编译Flutter项目