2017-06-09 99 views
5

我正在以下指定的錯誤,Android NDK錯誤。不能建造項目

E:\SDK\ndk-bundle\build\core\setup-app-platform.mk 

錯誤:(115)***的Android NDK:中止。停止。 錯誤:任務':un7zip:compileReleaseNdk'的執行失敗。

com.android.ide.common.process.ProcessException: Error while executing process E:\sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=E:\appRizort\RizortCardboard\un7zip\build\intermediates\ndk\release\Android.mk APP_PLATFORM=android-25 NDK_OUT=E:\appRizort\RizortCardboard\un7zip\build\intermediates\ndk\release\obj NDK_LIBS_OUT=E:\appRizort\RizortCardboard\un7zip\build\intermediates\ndk\release\lib APP_ABI=armeabi-v7a,armeabi,x86,arm64-v8a}

+0

NDK不支持** android-25 **平臺。你可以設置** android-24 **或(與r15 beta)** android-26 **。 –

+1

是的,這件事情奏效。謝謝。 @AlexCohn –

+0

即使使用android-26,我也會在Android Studio中將NDK_PROJECT_PATH設爲null。但是,如果我從命令提示符運行它,構建工作正常。 – RisingUp

回答

4

你NDK_PROJECT_PATH爲空,如果你的項目文件夾路徑包含空格,則可能會導致此問題。

+0

不存在空格 –

+0

Android Studio中的gradle Android插件運行** ndk-build **時,'NDK_PROJECT_PATH'爲null,這是猶太教。 –

2

APP_PLATFORM您在使用NDK構建項目的本機部分時指定的內容非常重要。這個故事是described at length in the NDK guide

This variable contains the minimum Android platform version you want to support. For example, a value of android-15 specifies that your library uses APIs that are not available below Android 4.0.3 (API level 15) and can't be used on devices running a lower platform version. For a complete list of platform names and corresponding Android system images, see Android NDK Native APIs .

Instead of changing this flag directly, you should set the minSdkVersion property in the defaultConfig or productFlavors blocks of your module-level build.gradle file . This makes sure your library is used only by apps installed on devices running an adequate version of Android. The ndk-build toolchain uses the following logic to choose the minimum platform version for your library based the ABI you're building and the minSdkVersion you specify:

  1. If there exists a platform version for the ABI equal to minSdkVersion , ndk-build uses that version.
  2. Otherwise, if there exists platform versions lower than minSdkVersion for the ABI, ndk-build uses the highest of those platform versions. This is a reasonable choice because a missing platform version typically means that there were no changes to the native platform APIs since the previous available version.
  3. Otherwise, ndk-build uses the next available platform version higher than minSdkVersion .

NDK沒有單獨android-25平臺。如果您的最小支持平臺是O,您可以選擇android-24或(與r15測試版),android-26。如果您的minSdkVersion較少,或者有疑問,請選擇較低的NDK平臺,因爲NDK平臺向上兼容。