Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

NDK doesn't load NDK Libs #529

Closed
sjfricke opened this issue Jan 20, 2018 · 6 comments
Closed

NDK doesn't load NDK Libs #529

sjfricke opened this issue Jan 20, 2018 · 6 comments

Comments

@sjfricke
Copy link

So I extracted the NDK with gradlew and I get this error when trying to build:

Error:(20, 17) fatal error: jni.h: No such file or directory
Error:(20, 35) fatal error: android/asset_manager.h: No such file or directory

Error:Execution failed for task ':samples-ndk-controllerpaint:compileControllerpaint_jniArm64-v8aDebugSharedLibraryControllerpaint_jniArm64-v8aDebugSharedLibraryMainCpp'.

I quick did the "Hello String from C++" from a new project so I know for a fact my NDK path is correct. I have looked and tried messing around, but cannot figure why it won't find my NDK libs

@jdduke
Copy link

jdduke commented Feb 14, 2018

Were you able to resolve the issue? How exactly are you building the project? Can you post a complete build log?

@jdduke
Copy link

jdduke commented Feb 26, 2018

Without additional feedback it's hard to troubleshoot the problem, feel free to re-open with more details.

@jdduke jdduke closed this as completed Feb 26, 2018
@nyankosoft
Copy link

I am having an issue that looks similar to this. My environment is this:
OS: Ubuntu 16.04 LTS 64-bit
Android Studio: 3.0.1

To elaborate a little more, the errors sjfricke posted (jni.h/asset_manager.h missing) happen on my computer when I run './gradlew build' from the terminal. When I build the project from Android Studio by selecting Build -> Make Project, it causes errors saying headers such as android/log.h and EGL/egl.h are missing. I ran the find command on all of these 4 headers and all of them exist in the SDK's 'ndk-bundle/sysroot/usr/include' directory.

NDK settings on my PC should be good; when I create a sample hello world NDK project using the Android Studio, it builds apks files without any problem and they work on my Moto G5 Plus just fine.

As the NDK treasurehunt sample is the one I need, I extracted it and copied their source files and other library files onto a functioning hello world NDK project, then edited the build.gradle so that treasurehunt source files are compiled and linked (see below). After some troubleshooting, my rip-off copy of NDK treasurehunt demo now runs on my Moto. So the answer should be somewhere in the differences between the original Google VR SDK's treasurehunt and my rip-off version.

https://github.com/nyankosoft/nyanko-ndk-treasurehunt

@sigmaxipi
Copy link

@nyankosoft, @sjfricke: you may be using a newer version of the NDK than what is supported. The existing samples use gradle-experimental:0.9.3 which uses an old NDK header layout. In the next version of the SDK, we're switching from the experimental NDK plugin to the standard NDK plugin which should fix this issue.

If you install NDK r15c or earlier, the build will work. If you install only NDK r16b or later, the build will fail due to the header layout. More information about header migration is at https://android.googlesource.com/platform/ndk/+/ndk-release-r16/CHANGELOG.md and the linked docs.

@sigmaxipi sigmaxipi reopened this Mar 16, 2018
@nyankosoft
Copy link

nyankosoft commented Mar 17, 2018

SDK Manager says my NDK is version 16.1.4479499, so if this is the NDK version you are referring to, yes, this is probably the cause. Personally, I've got the sample I needed (ndk treasurehunt demo) working by adapting it to my current NDK 16.1, so I'm leaning toward developing the situation more with it, but thanks anyway.

screenshot from 2018-03-17 13-02-09

@jdduke
Copy link

jdduke commented Apr 10, 2018

The latest 1.40.0 release adds support for CMake.

@jdduke jdduke closed this as completed Apr 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants