简体   繁体   中英

NDK samples with Android Studio 1.3 preview: can't find headers

I am trying to use the android ndk samples (such as Teapot or san-angeles) with Android Studio 1.3 preview and the new experimental NDK plugin . When I run, I get the following errors:

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.

I was able to run fine yesterday, before I upgraded Android Studio from AI-141.1962279 (I think) to AI-141.2117773. How can I get this working? Could these errors stem from the backslash preceding cdefs.h and egl.h?

My local.settings contains:

sdk.dir=E\:\\Android\\sdk
ndk.dir=E\:\\Android\\ndk

My system:

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

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM