Execution failed for task ':react-native-update:compileReleaseNdk'.NDK not configured.

錯誤信息

* What went wrong:
Execution failed for task ':react-native-update:compileReleaseNdk'.
> NDK not configured.
  Download the NDK from http://developer.android.com/tools/sdk/ndk/.Then add ndk.dir=path/to/ndk in local.properties.
  (On Windows, make sure you escape backslashes, e.g. C:\\ndk rather than C:\ndk)

解決方法:下載安裝NDK和相關工具,菜單進入 Tools > Android > SDK Manager 在選項卡中選擇 SDK Tools,選擇 LLDB, CMake, 和 NDK 勾選,點擊 Apply 進行下載安裝。

Error: Your project contains C++ files but it is not using a supported native build system.

今天用Android Studio3.1.4導入一個項目,結果報錯:Error: Your project contains C++ files but it is not using a supported native build system.
Consider using CMake or ndk-build integration. For more information, go to:
 https://d.android.com/r/studio-ui/add-native-code.html
Alternatively, you can use the experimental plugin:
 https://developer.android.com/r/tools/experimental-plugin.html

一、在項目的gradle.properties添加
android.useDeprecatedNdk=true

二、這個bug比較好解決在app的build.gradle中添加如下代碼即可:

在module的build.gradle(Module:app)的buildTypes上面添加sourceSets屬性

sourceSets {
main {
jni.srcDirs = []
  }
}

buildTypes{
}

 

在local.properties文件夾中添加ndk路徑

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章