flutter项目文件夹移动位置后要flutter clean

27 次阅读

本文最后更新于 2026年5月11日。

直接flutter run会报cmake位置不匹配

CMake Error: The current CMakeCache.txt directory E:/mydoc/mygit/myWPapp/my_wordpress/flutter_application_1/build/windows/x64/CMakeCache.txt is different than the directory e:/mydoc/sync_pc_home_work/myWPapp/my_wordpress/flutter_application_1/build/windows/x64 where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
CMake Error: The source "E:/mydoc/mygit/myWPapp/my_wordpress/flutter_application_1/windows/CMakeLists.txt" does not match the source "E:/mydoc/sync_pc_home_work/myWPapp/my_wordpress/flutter_application_1/windows/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.
Building Windows application...                                    299ms
Error: Unable to generate build files

运行flutter pub get也不能解决

运行flutter clean再run就好了

对git不影响