Build command failed. Error while executing process 錯誤
android ndk專案有時編譯會報這樣的錯,但你又不清楚到底哪兒出錯了
Build command failed.
Error while executing process D:\work\adt-bundle\sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\.externalNativeBuild\cmake\debug\x86 --target native-lib}
[1/2] Building CXX object CMakeFiles/native-lib.dir/src/main/cpp/WlFFmpeg.cpp.o
FAILED: D:\work\tools\depend\android-ndk-r14b-windows-x86_64\android-ndk-r14b\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=i686-none-linux-android --gcc-toolchain=D:/work/tools/depend/android-ndk-r14b-windows-x86_64/android-ndk-r14b/toolchains/x86-4.9/prebuilt/windows-x86_64 --sysroot=D:/work/tools/depend/android-ndk-r14b-windows-x86_64/android-ndk-r14b/platforms/android-22/arch-x86 -Dnative_lib_EXPORTS -I../../../../src/main/cpp/include -isystem D:/work/tools/depend/android-ndk-r14b-windows-x86_64/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem D:/work/tools/depend/android-ndk-r14b-windows-x86_64/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include -isystem D:/work/tools/depend/android-ndk-r14b-windows-x86_64/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -Wa,--noexecstack -Wformat -Werror=format-security -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -Wa,--noexecstack -Wformat -Werror=format-security -frtti -fexceptions -O0 -fno-limit-debug-info -O0 -fno-limit-debug-info -fPIC -MD -MT CMakeFiles/native-lib.dir/src/main/cpp/WlFFmpeg.cpp.o -MF CMakeFiles\native-lib.dir\src\main\cpp\WlFFmpeg.cpp.o.d -o CMakeFiles/native-lib.dir/src/main/cpp/WlFFmpeg.cpp.o -c D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp\WlFFmpeg.cpp
In file included from D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp\WlFFmpeg.cpp:6:
In file included from D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp/WlFFmpeg.h:10:
In file included from D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp/WlAudio.h:8:
In file included from D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp/WlQueue.h:11:
D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp/WlPlaystatus.h:13:15: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
bool load = true;
........
../../../../src/main/cpp/include\libavformat/avformat.h:2042:6: note: candidate function not viable: no known conversion from 'AVFormatContext **' to 'AVFormatContext *' for 1st argument; remove &
void avformat_free_context(AVFormatContext *s);
^
21 warnings
ninja: build stopped: subcommand failed.
你會發現最後只有waring,沒有error,又不知道哪錯了
這時你把專案clean一下,又報錯,無視
再rebuild一下,又報錯,繼續無視,
現在再編譯 ,報錯了,你會發現,堆疊的最後打出了錯誤資訊
In file included from D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp\WlFFmpeg.cpp:6:
D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp/WlFFmpeg.h:31:15: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
bool exit = false;
^
D:\work\workplace\studio_workspace\MyMusic181114_4\myplayer\src\main\cpp\WlFFmpeg.cpp:222:9: error
avformat_free_context(&avFormatContext);
^~~~~~~~~~~~~~~~~~~~~
../../../../src/main/cpp/include\libavformat/avformat.h:2042:6: note: candidate function not viable: no known conversion from 'AVFormatContext **' to 'AVFormatContext *' for 1st argument; remove &
void avformat_free_context(AVFormatContext *s);
^
21 warnings and 1 error generated.
ninja: build stopped: subcommand failed.
這時你可以根據提示進行修改了!!