将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.
答案 0 :(得分: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()
SET(CMAKE_CXX_FLAGS“-isystem / home / cc / Android / Sdk / ndk-bundle / sysroot / usr / include / arm-linux-androideabi”)
include_directories($ {ANDROID_SYSROOT}的/ usr /包括/ ARM-Linux的androideabi)
答案 1 :(得分:8)
Lemac的答案中的方法一对我有所改变:
$ python tdjson_example.py
Android Studio 3.0.1版,NDK 16.1.4479499。
答案 2 :(得分:4)
除了Alex Cohn回答,在我的情况下,问题是存在
我的CMakeList.txt中的set(CMAKE_C_FLAGS,...)
此声明与.gradle externalNativeBuild{ cmake { cFlags="..."}}
似乎-isystem被Gradle插件添加到CFLAGS,不包括目录列表
答案 3 :(得分:1)
您的编译参数未命中
'com.android.tools.build:gradle:2.3.1'
您已将NDK升级到r15,但不是Android Studio和gradle插件。对我来说,带有…/include/arm-linux-androideabi
(不是最新的)的Android Studio 3.0(预览版)会生成正确的编译命令。
如果您不想切换到Android Studio的预览版,可以手动将路径添加到import UIKit
class FriendCVCell: UICollectionViewCell {
@IBOutlet weak var FriendNameLabel: UILabel!
@IBOutlet weak var FriendMobileNOLabel: UILabel!
}
。
答案 4 :(得分:0)
我遇到了一个非常相似的案例。我在CMakeLists.txt中设置了CMAKE_C_FLAGS
和CMAKE_CXX_FLAGS
:
set(CMAKE_C_FLAGS "${MY_CUSTOM_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${MY_CUSTOM_CXX_FLAGS}")
但是,由于在调用cmake时android.toolchain.cmake用作工具链文件,因此cmake首先会解释android.toolchain.cmake的内容(这将在CMAKE_C_FLAGS和CMAKE_CXX_FLAGS上设置值),然后将我的设置加载到CMakeLists.txt中。也就是说,我终于改成了这个:
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_CUSTOM_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_CUSTOM_CXX_FLAGS}")