我正在尝试构建我的 Flutter 应用程序。但它正在显示这一点。
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':pdfrx:configureCMakeRelWithDebInfo[arm64-v8a]'.
> [CXX1405] error when building with cmake using C:\Users\Miraj Hossain\AppData\Local\Pub\Cache\hosted\pub.dev\pdfrx-0.4.8\android\CMakeLists.txt: Build command failed.
Error while executing process C:\Users\Miraj Hossain\AppData\Local\Android\sdk\cmake\3.18.1\bin\cmake.exe with arguments {-HC:\Users\Miraj Hossain\AppData\Local\Pub\Cache\hosted\pub.dev\pdfrx-0.4.8\android -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=19 -DANDROID_PLATFORM=android-19 -DANDROID_ABI=arm64-v8a -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DANDROID_NDK=C:\Users\Miraj Hossain\AppData\Local\Android\sdk\ndk\21.4.7075529 -DCMAKE_ANDROID_NDK=C:\Users\Miraj Hossain\AppData\Local\Android\sdk\ndk\21.4.7075529 -DCMAKE_TOOLCHAIN_FILE=C:\Users\Miraj Hossain\AppData\Local\Android\sdk\ndk\21.4.7075529\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\Miraj Hossain\AppData\Local\Android\sdk\cmake\3.18.1\bin\ninja.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=E:\Flutter_Projects\hospital_booking_system\build\pdfrx\intermediates\cxx\RelWithDebInfo\i4455492\obj\arm64-v8a -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=E:\Flutter_Projects\hospital_booking_system\build\pdfrx\intermediates\cxx\RelWithDebInfo\i4455492\obj\arm64-v8a -DCMAKE_BUILD_TYPE=RelWithDebInfo -BC:\Users\Miraj Hossain\AppData\Local\Pub\Cache\hosted\pub.dev\pdfrx-0.4.8\android\.cxx\RelWithDebInfo\i4455492\arm64-v8a -GNinja}
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Users/Miraj Hossain/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring incomplete, errors occurred!
See also "C:/Users/Miraj Hossain/AppData/Local/Pub/Cache/hosted/pub.dev/pdfrx-0.4.8/android/.cxx/RelWithDebInfo/i4455492/arm64-v8a/CMakeFiles/CMakeOutput.log".
CMake Error at CMakeLists.txt:62 (file):
file Failed to create link 'C:/Users/Miraj
Hossain/AppData/Local/Pub/Cache/hosted/pub.dev/pdfrx-0.4.8/android/.lib/latest'
because existing path cannot be removed: No error
CMake Warning (dev) at CMakeLists.txt:66 (set):
Cannot set "pdfrx_bundled_libraries": current scope has no parent.
This warning is for project developers. Use -Wno-dev to suppress it.
* 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
Flutter 项目中的此错误通常发生在涉及 CMake 的构建过程中,尤其是在处理本机代码或外部 C++ 依赖项(主要通过使用包或平台通道)时。此错误通常表示 CMake 配置存在问题或构建环境中存在冲突。
您可以通过清理和清除缓存来快速解决此问题。
flutter clean
清除构建目录并删除任何现有的构建输出
rm -rf bin
rm -rf obj
rm -rf .gradle
手动删除项目中的
bin
、obj
和 .gradle
目录。这些目录可能包含生成的文件和缓存,这些文件和缓存可能会导致构建问题。
flutter pub cache repair
这将删除并重新下载项目中的所有包。这是解决可能由损坏或不正确下载的软件包引起的问题的有用步骤。