Ryan Cori
Ryan Cori

Reputation: 435

android studio 2.1 issue with NDK

I am trying to use AndEngine with Android Studio 2.1 and I am running issues specifically with the NDK stuff. The version of AndEngine I am trying to use is the GLES2-AnchorCenter for reference. I create my project and add AndEngine as a module, then give my project a dependency on my AndEngine module. What I end up with is an issue with native code, specifically in in GLES20Fix.c. I get an error message about openGL ES2.0 specific stuff:

Error:(8) undefined reference to `glVertexAttribPointer'
Error:(12) undefined reference to `glDrawElements'`

I know this topic has come up before and I have read this article on the subject but that's what I was already trying to follow and that uses an older version of Android Studio that has a different import option I do not have in 2.1. I have also checked and the NDK plugin for android studio is installed and my minimum build target is over SDK level 9.

One strange detail: when I tried importing andengine as a library in eclipse it worked okay. I don't want to rely on that because I know eclipse is no longer supported for android developer tools so I want to switch off it to the newest version of Android Studio.

Upvotes: 0

Views: 304

Answers (2)

ya man
ya man

Reputation: 547

I had the same issue. This answer helped me.

I just needed to add the following to build.gradle:

sourceSets {
    main {
        jni.srcDirs = []
        jniLibs.srcDir 'libs'
    }
}

and then rebuild the project.

Upvotes: 0

Harkish
Harkish

Reputation: 2372

Can you try adding

ldLibs.addAll(['EGL', 'GLESv2'])

eg. https://github.com/googlesamples/android-ndk/blob/master/Teapot/app/build.gradle

Upvotes: 0

Related Questions