Android Studio 解决:error adding symbols: File in wrong format clang++.exe: error: linker command...

  1. 云栖社区>
  2. 博客>
  3. 正文

Android Studio 解决:error adding symbols: File in wrong format clang++.exe: error: linker command...

凌浩雨 2018-01-12 15:12:00 浏览2917
展开阅读全文

错误日志:

Error:FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:externalNativeBuildDebug'.
> Build command failed.
Error while executing 'D:\java\androidstudio\sdk\cmake\3.6.4111459\bin\cmake.exe' with arguments {--build F:\test\FFmpegTest\app\.externalNativeBuild\cmake\debug\mips64 --target native-lib}
[1/2] Building CXX object CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o
[2/2] Linking CXX shared library ..\..\..\..\build\intermediates\cmake\debug\obj\mips64\libnative-lib.so
FAILED: cmd.exe /C "cd . && D:\java\androidstudio\sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe  --target=mips64el-none-linux-android --gcc-toolchain=D:/java/androidstudio/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/windows-x86_64 --sysroot=D:/java/androidstudio/sdk/ndk-bundle/sysroot -fPIC -isystem D:/java/androidstudio/sdk/ndk-bundle/sysroot/usr/include/mips64el-linux-android -D__ANDROID_API__=21 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fintegrated-as -Wa,--noexecstack -Wformat -Werror=format-security   -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a --sysroot D:/java/androidstudio/sdk/ndk-bundle/platforms/android-21/arch-mips64 -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libnative-lib.so -o ..\..\..\..\build\intermediates\cmake\debug\obj\mips64\libnative-lib.so CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o  ../../../../libs/armeabi-v7a/libswresample-2.so ../../../../libs/armeabi-v7a/libavcodec-57.so ../../../../libs/armeabi-v7a/libavfilter-6.so ../../../../libs/armeabi-v7a/libswscale-4.so ../../../../libs/armeabi-v7a/libavdevice-57.so ../../../../libs/armeabi-v7a/libavformat-57.so -llog -lm "D:/java/androidstudio/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips64/libgnustl_static.a" && cd ."
../../../../libs/armeabi-v7a/libswresample-2.so: error adding symbols: File in wrong format
  clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

错误原因:

libs文件夹下的架构包缺失,使用ndk abi过滤器过滤即可解决。

解决:

在build.gradle中ndk模块中添加下面的代码:abiFilters 'armeabi'
添加后的代码长这样:

ndk {
      abiFilters 'armeabi'
    }

网友评论

登录后评论
0/500
评论