未找到Android ndk错误asm types.h

Cau*_*arz 6 android android-ndk android-studio

将Android Studio更新到2.3.3并更新ndk软件包后,我的项目无法构建.错误是什么意思?它应该是IDE的错误.如何解决问题或如何回到以前的Android Studio/ndk版本?

Error:?: ???????????????? API?
?: ??????, ??? -Xlint:deprecation ?????
?: /home/noob/code/greatcompany/ExcellentApk/app/src/main/java/com/greatcompanyx/ExcellentApk/yjzb/CtrlNetTool.java???????????????
?: ??????, ??? -Xlint:unchecked ?????
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:externalNativeBuildRelease'.
> Build command failed.
  Error while executing process /home/noob/Android/Sdk/cmake/3.6.3155560/bin/cmake with arguments {--build /home/noob/code/greatcompany/ExcellentApk/app/.externalNativeBuild/cmake/release/armeabi-v7a --target greatcompany-foot}
  [1/1] Re-running CMake...
  -- Configuring done
  ??Android????
  -- Generating done
  -- Build files have been written to: /home/noob/code/greatcompany/ExcellentApk/app/.externalNativeBuild/cmake/release/armeabi-v7a
  [1/17] Building CXX object src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/Buffer.cpp.o
  [2/17] Building CXX object src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/aec/aec.cpp.o
  [3/17] Building CXX object src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/beamforming/delaysum.cpp.o
  [4/17] Building CXX object src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/kws/sentence/Sentence_kws.cpp.o
  [5/17] Building CXX object src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/kws/sentence/Sentence_posthandler.cpp.o
  [6/17] Building CXX object src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/kws/sentence/Sentence_feature_extractor.cpp.o
  FAILED: /home/noob/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  --target=armv7-none-linux-androideabi --gcc-toolchain=/home/noob/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/home/noob/Android/Sdk/ndk-bundle/sysroot  -DANDROID -DNDEBUG -Dgreatcompany_foot_EXPORTS -I../../../../src/main/cpp/greatcompany-foot/src -I../../../../src/main/cpp/greatcompany-foot/src/3rdparty/eigen3 -I../../../../src/main/cpp/greatcompany-foot/src/utils -I../../../../src/main/cpp/greatcompany-foot/src/modules/beamforming -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -O3 -mfpu=neon -mfloat-abi=softfp -march=armv7-a -Wno-parentheses -Os -DNDEBUG  -fPIC   -std=gnu++11 -MD -MT src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/kws/sentence/Sentence_posthandler.cpp.o -MF src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/kws/sentence/Sentence_posthandler.cpp.o.d -o src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/kws/sentence/Sentence_posthandler.cpp.o -c /home/noob/code/greatcompany/ExcellentApk/app/src/main/cpp/greatcompany-foot/src/modules/kws/sentence/Sentence_posthandler.cpp
  In file included from /home/noob/code/greatcompany/ExcellentApk/app/src/main/cpp/greatcompany-foot/src/modules/kws/sentence/Sentence_posthandler.cpp:5:
  In file included from ../../../../src/main/cpp/greatcompany-foot/src/utils/json/json.h:50:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/stdlib.h:36:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/malloc.h:22:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/stdio.h:42:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/sys/types.h:36:
  /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/linux/types.h:21:10: fatal error: 'asm/types.h' file not found
  #include <asm/types.h>
           ^~~~~~~~~~~~~
  1 error generated.
  FAILED: /home/noob/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  --target=armv7-none-linux-androideabi --gcc-toolchain=/home/noob/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/home/noob/Android/Sdk/ndk-bundle/sysroot  -DANDROID -DNDEBUG -Dgreatcompany_foot_EXPORTS -I../../../../src/main/cpp/greatcompany-foot/src -I../../../../src/main/cpp/greatcompany-foot/src/3rdparty/eigen3 -I../../../../src/main/cpp/greatcompany-foot/src/utils -I../../../../src/main/cpp/greatcompany-foot/src/modules/beamforming -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -O3 -mfpu=neon -mfloat-abi=softfp -march=armv7-a -Wno-parentheses -Os -DNDEBUG  -fPIC   -std=gnu++11 -MD -MT src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/kws/sentence/Sentence_feature_extractor.cpp.o -MF src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/kws/sentence/Sentence_feature_extractor.cpp.o.d -o src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/kws/sentence/Sentence_feature_extractor.cpp.o -c /home/noob/code/greatcompany/ExcellentApk/app/src/main/cpp/greatcompany-foot/src/modules/kws/sentence/Sentence_feature_extractor.cpp
  In file included from /home/noob/code/greatcompany/ExcellentApk/app/src/main/cpp/greatcompany-foot/src/modules/kws/sentence/Sentence_feature_extractor.cpp:5:
  In file included from /home/noob/code/greatcompany/ExcellentApk/app/src/main/cpp/greatcompany-foot/src/modules/kws/sentence/Sentence_feature_extractor.h:18:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/stdlib.h:36:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/malloc.h:22:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/stdio.h:42:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/sys/types.h:36:
  /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/linux/types.h:21:10: fatal error: 'asm/types.h' file not found
  #include <asm/types.h>
           ^~~~~~~~~~~~~
  1 error generated.
  FAILED: /home/noob/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  --target=armv7-none-linux-androideabi --gcc-toolchain=/home/noob/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/home/noob/Android/Sdk/ndk-bundle/sysroot  -DANDROID -DNDEBUG -Dgreatcompany_foot_EXPORTS -I../../../../src/main/cpp/greatcompany-foot/src -I../../../../src/main/cpp/greatcompany-foot/src/3rdparty/eigen3 -I../../../../src/main/cpp/greatcompany-foot/src/utils -I../../../../src/main/cpp/greatcompany-foot/src/modules/beamforming -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -O3 -mfpu=neon -mfloat-abi=softfp -march=armv7-a -Wno-parentheses -Os -DNDEBUG  -fPIC   -std=gnu++11 -MD -MT src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/aec/aec.cpp.o -MF src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/aec/aec.cpp.o.d -o src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/aec/aec.cpp.o -c /home/noob/code/greatcompany/ExcellentApk/app/src/main/cpp/greatcompany-foot/src/modules/aec/aec.cpp
  In file included from /home/noob/code/greatcompany/ExcellentApk/app/src/main/cpp/greatcompany-foot/src/modules/aec/aec.cpp:5:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/iostream:39:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/ostream:38:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/ios:38:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/iosfwd:40:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/postypes.h:40:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/cwchar:44:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/wchar.h:32:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/stdio.h:42:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/sys/types.h:36:
  /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/linux/types.h:21:10: fatal error: 'asm/types.h' file not found
  #include <asm/types.h>
           ^~~~~~~~~~~~~
  1 error generated.
  FAILED: /home/noob/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  --target=armv7-none-linux-androideabi --gcc-toolchain=/home/noob/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/home/noob/Android/Sdk/ndk-bundle/sysroot  -DANDROID -DNDEBUG -Dgreatcompany_foot_EXPORTS -I../../../../src/main/cpp/greatcompany-foot/src -I../../../../src/main/cpp/greatcompany-foot/src/3rdparty/eigen3 -I../../../../src/main/cpp/greatcompany-foot/src/utils -I../../../../src/main/cpp/greatcompany-foot/src/modules/beamforming -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -O3 -mfpu=neon -mfloat-abi=softfp -march=armv7-a -Wno-parentheses -Os -DNDEBUG  -fPIC   -std=gnu++11 -MD -MT src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/kws/sentence/Sentence_kws.cpp.o -MF src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/kws/sentence/Sentence_kws.cpp.o.d -o src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/kws/sentence/Sentence_kws.cpp.o -c /home/noob/code/greatcompany/ExcellentApk/app/src/main/cpp/greatcompany-foot/src/modules/kws/sentence/Sentence_kws.cpp
  In file included from /home/noob/code/greatcompany/ExcellentApk/app/src/main/cpp/greatcompany-foot/src/modules/kws/sentence/Sentence_kws.cpp:6:
  In file included from ../../../../src/main/cpp/greatcompany-foot/src/utils/json/json.h:50:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/stdlib.h:36:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/malloc.h:22:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/stdio.h:42:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/sys/types.h:36:
  /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/linux/types.h:21:10: fatal error: 'asm/types.h' file not found
  #include <asm/types.h>
           ^~~~~~~~~~~~~
  1 error generated.
  FAILED: /home/noob/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  --target=armv7-none-linux-androideabi --gcc-toolchain=/home/noob/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/home/noob/Android/Sdk/ndk-bundle/sysroot  -DANDROID -DNDEBUG -Dgreatcompany_foot_EXPORTS -I../../../../src/main/cpp/greatcompany-foot/src -I../../../../src/main/cpp/greatcompany-foot/src/3rdparty/eigen3 -I../../../../src/main/cpp/greatcompany-foot/src/utils -I../../../../src/main/cpp/greatcompany-foot/src/modules/beamforming -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -O3 -mfpu=neon -mfloat-abi=softfp -march=armv7-a -Wno-parentheses -Os -DNDEBUG  -fPIC   -std=gnu++11 -MD -MT src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/Buffer.cpp.o -MF src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/Buffer.cpp.o.d -o src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/Buffer.cpp.o -c /home/noob/code/greatcompany/ExcellentApk/app/src/main/cpp/greatcompany-foot/src/Buffer.cpp
  In file included from /home/noob/code/greatcompany/ExcellentApk/app/src/main/cpp/greatcompany-foot/src/Buffer.cpp:5:
  In file included from ../../../../src/main/cpp/greatcompany-foot/src/Buffer.h:11:
  In file included from ../../../../src/main/cpp/greatcompany-foot/src/3rdparty/eigen3/Eigen/Core:80:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/complex:45:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/sstream:38:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/istream:38:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/ios:38:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/iosfwd:40:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/postypes.h:40:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/cwchar:44:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/wchar.h:32:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/stdio.h:42:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/sys/types.h:36:
  /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/linux/types.h:21:10: fatal error: 'asm/types.h' file not found
  #include <asm/types.h>
           ^~~~~~~~~~~~~
  1 error generated.
  FAILED: /home/noob/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  --target=armv7-none-linux-androideabi --gcc-toolchain=/home/noob/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/home/noob/Android/Sdk/ndk-bundle/sysroot  -DANDROID -DNDEBUG -Dgreatcompany_foot_EXPORTS -I../../../../src/main/cpp/greatcompany-foot/src -I../../../../src/main/cpp/greatcompany-foot/src/3rdparty/eigen3 -I../../../../src/main/cpp/greatcompany-foot/src/utils -I../../../../src/main/cpp/greatcompany-foot/src/modules/beamforming -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -O3 -mfpu=neon -mfloat-abi=softfp -march=armv7-a -Wno-parentheses -Os -DNDEBUG  -fPIC   -std=gnu++11 -MD -MT src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/beamforming/delaysum.cpp.o -MF src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/beamforming/delaysum.cpp.o.d -o src/main/cpp/greatcompany-foot/CMakeFiles/greatcompany-foot.dir/src/modules/beamforming/delaysum.cpp.o -c /home/noob/code/greatcompany/ExcellentApk/app/src/main/cpp/greatcompany-foot/src/modules/beamforming/delaysum.cpp
  In file included from /home/noob/code/greatcompany/ExcellentApk/app/src/main/cpp/greatcompany-foot/src/modules/beamforming/delaysum.cpp:4:
  In file included from ../../../../src/main/cpp/greatcompany-foot/src/modules/beamforming/delaysum.h:14:
  In file included from ../../../../src/main/cpp/greatcompany-foot/src/3rdparty/eigen3/Eigen/Dense:1:
  In file included from ../../../../src/main/cpp/greatcompany-foot/src/3rdparty/eigen3/Eigen/Core:80:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/complex:45:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/sstream:38:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/istream:38:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/ios:38:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/iosfwd:40:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/postypes.h:40:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include/cwchar:44:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/wchar.h:32:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/stdio.h:42:
  In file included from /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/sys/types.h:36:
  /home/noob/Android/Sdk/ndk-bundle/sysroot/usr/include/linux/types.h:21:10: fatal error: 'asm/types.h' file not found
  #include <asm/types.h>
           ^~~~~~~~~~~~~
  1 error generated.
  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.
Run Code Online (Sandbox Code Playgroud)

lem*_*mac 9

在Android studio 3.0和ndk 15中,我也遇到了这个错误.但我解决了这个问题,但用中文分析了.

http://www.jianshu.com/p/27f98165d73d

方法 :

if(${ANDROID_ABI} STREQUAL "armeabi-v7a")
    include_directories(${ANDROID_SYSROOT}/usr/include/arm-linux-androideabi)
elseif(${ANDROID_ABI} STREQUAL "arm64-v8a")
    include_directories(${ANDROID_SYSROOT}/usr/include/aarch64-linux-android)
else()
    include_directories(${ANDROID_SYSROOT}/usr/include/arm-linux-androideabi)
endif()
Run Code Online (Sandbox Code Playgroud)

方法2

SET(CMAKE_CXX_FLAGS"-isystem/home/cc/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi")

方法3

include_directories($ {ANDROID_SYSROOT}的/ usr /包括/臂-Linux的androideabi)


小智 8

Lemac的答案中的方法一为我做了一些修改:

if (${ANDROID_ABI} STREQUAL "x86_64")
    include_directories(${ANDROID_SYSROOT}/usr/include/x86_64-linux-android)
elseif (${ANDROID_ABI} STREQUAL "x86")
    include_directories(${ANDROID_SYSROOT}/usr/include/i686-linux-android)
elseif (${ANDROID_ABI} STREQUAL "arm64-v8a")
    include_directories(${ANDROID_SYSROOT}/usr/include/aarch64-linux-android)
elseif (${ANDROID_ABI} STREQUAL "armeabi-v7a")
    include_directories(${ANDROID_SYSROOT}/usr/include/arm-linux-androideabi)
endif()
Run Code Online (Sandbox Code Playgroud)

Android Studio版本3.0.1,NDK 16.1.4479499.