今天使用訊飛aiui串口開發包的時候遇到了如下錯誤
1.出現找不到ndk:
Error:Execution failed for task ':serialPortLibrary: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.htmlor use the experimental plugin: http://tools.android.com/tech-docs/new-build-system/gradle-experimental.
解決辦法:在項目的gradle.properties文件中加入這句
android.useDeprecatedNdk=true
2.在解決了上述問題之後,又出現瞭如下錯誤
Error:Execution failed for task ':UARTKit:uart:compileReleaseNdk'.
> com.android.ide.common.process.ProcessException: Error while executing '/Users/kzx/Library/Android/sdk/ndk-bundle/ndk-build' with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/kzx/Downloads/AIUI評估板開發包-1042/串口開發包/UARTKit/uart/build/intermediates/ndk/release/Android.mk APP_PLATFORM=android-20 NDK_OUT=/Users/kzx/Downloads/AIUI評估板開發包-1042/串口開發包/UARTKit/uart/build/intermediates/ndk/release/obj NDK_LIBS_OUT=/Users/kzx/Downloads/AIUI評估板開發包-1042/串口開發包/UARTKit/uart/build/intermediates/ndk/release/lib APP_ABI=all}
解決方法:在你導入的包含jni的庫的build.gradle文件的android標籤中加入這句
sourceSets.main { jni.srcDirs = [] }