我正在尝试将android ndk samples(例如Teapot或san-angeles)与Android Studio 1.3预览版和新experimental NDK plugin一起使用。当我跑步时,我收到以下错误:
E:\code\android-ndk-samples-preview\Teapot\app\src\main\jni\cpufeatures\cpu-features.h
sys/cdefs.h: No such file or directory
E:\code\android-ndk-samples-preview\Teapot\app\src\main\jni\native_app_glue\android_native_app_glue.c
jni.h: No such file or directory
E:\code\android-ndk-samples-preview\Teapot\app\src\main\jni\ndk_helper\gl3stub.c
EGL/egl.h: No such file or directory
Error:Execution failed for task ':app:compileArmeabi-v7aDebugArm7TeapotNativeActivitySharedLibraryTeapotNativeActivityMainC'.
Multiple build operations failed.
C compiler failed while compiling cpu-features.c.
C compiler failed while compiling android_native_app_glue.c.
C compiler failed while compiling gl3stub.c.
在我将Android Studio从AI-141.1962279(我认为)升级到AI-141.2117773之前,我昨天能够正常运行。我怎样才能使这个工作?这些错误是否源于cdefs.h和egl.h之前的反斜杠?
我的local.settings包含:
sdk.dir=E\:\\Android\\sdk
ndk.dir=E\:\\Android\\ndk
我的系统:
Windows 8.1 64 bit
Android Studio 1.3
Build tools 22.0.1
Gradle 2.5
NDK r10e extracted to E:\Android\sdk\ndk-bundle
Device: Project Tango Tablet with Schur core
答案 0 :(得分:1)
I was able to get the samples running by doing the following:
I went to settings, Appearance & Behavior, System Settings, Android SDK, selected the SDK Tools tab, and noticed Android NDK version 1.0.0 unchecked at the bottom of the list. I checked it, which installed NDK (I then saw a new directory named ndk-bundle inside my sdk directory). Then I changed local.properties to point to the new ndk-bundle directory. Re sync gradle and run and now it works!