Tuesday, September 23, 2014

# KitKat NDK APP_PLATFORM Values : android/asset_manager.h: No such file or directory -

You might get an error android/asset_manager.h: No such file or directory
while making an NDK project.

The APP_PLATFORM has to be updated to android-14, which may fix the problem.


android-3      -> Official Android 1.5 system images
android-4      -> Official Android 1.6 system images
android-5      -> Official Android 2.0 system images
android-6      -> Official Android 2.0.1 system images
android-7      -> Official Android 2.1 system images
android-8      -> Official Android 2.2 system images
android-9      -> Official Android 2.3 system images
android-14     -> Official Android 4.0 system images
Also, make sure that both Application.mk and Android.mk is present in jni folder. 
Supported headers are at $NDK/platforms/android-/arch-arm/usr/include

OPENGL NDK build problem using Android Studio on Mac OS

While building NDK application that consumes OPENGL, may not compile properly.
First make sure you have
ndk.dir= in local.settings
Also, the ndk folder has to be in PATH.
echo $PATH will show whats there in path and what is not.


You may get error like -
error: undefined reference to 'glGetUniformLocation'
error: undefined reference to 'glGetAttribLocation'
error: undefined reference to 'glUseProgram'
error: undefined reference to 'glBindTexture'
error: undefined reference to 'glUniform2f'
error: undefined reference to 'glVertexAttribPointer'
.......

I also saw that the Headers files for OPENGL framework in Mac OS was missing. You can update that using:
xcode-select --install

However, the error will not go.

The solution is:
Deactivate the ndk compilation from gradle by setting in build.gradle of your module. ( the inner one).
Place it inside under android tag:, below the build tool version

sourceSets.main {   
jni.srcDirs = []
    jniLibs.srcDir 'src/main/libs'
}
to be able to call ndk-build yourself and integrate libs from libs/.
Do a ndk-build at app/src/main, where jni folder resides.
The compiled jni code will be in 'src/main/libs'

Then install the app by gradle iD