最近由於項目須要下載Android終端模擬器(Android-Terminal-Emulator)源碼進行調試編譯,編譯過程當中出現報錯html
Error:Execution failed for task ':libtermexec:compileReleaseNdk'. > Error: Your project contains C++ files but it is not using a supported native build system. Consider using CMake or ndk-build integration with the stable Android Gradle plugin: https://developer.android.com/studio/projects/add-native-code.html or use the experimental plugin: https://developer.android.com/studio/build/experimental-plugin.html.
頓時不知道因此然,Google之後,在stackoverflow找到解決方法,
1、在項目的gradle.properties添加
android.useDeprecatedNdk=trueandroid
2、在module的build.gradle(Module:app)的buildTypes上面添加sourceSets屬性app
sourceSets { main { jni.srcDirs = [] } } buildTypes{ }
最後運行gradle腳本更新build,在編譯module便可。ide
這個問題主要是由於Android studio之前使用ndkCompile後來廢棄掉了,Android-Terminal-Emulator沒有最近沒有更新的緣故。具體的編譯最新的NDK編譯方式能夠看官網
https://developer.android.com/studio/projects/add-native-code.htmlgradle
參考連接:http://stackoverflow.com/questions/40065871/error-your-project-contains-c-files-but-it-is-not-using-a-supported-native-bu/40283476
https://developer.android.com/studio/projects/add-native-code.htmlui
同行的網友也寫過解決方案
http://blog.csdn.net/susubuhui/article/details/53057188
http://www.cnblogs.com/qianyukun/p/6405291.htmlspa