5

I took the source of AndEngine from their git repo, downloaded a fresh AndroidStudio, sdk and ndk,imported it, and tried to creat a simple new empty GameActivity extends BaseGameActivity.

But I could not start it, cause I get the following errors:

/home/uhu/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/objs/andengine_shared//home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.o: in function Java_org_andengine_opengl_GLES20Fix_glVertexAttribPointer:/home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.c:9: error: undefined reference to 'glVertexAttribPointer'

/home/uhu/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/objs/andengine_shared//home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.o: in function Java_org_andengine_opengl_GLES20Fix_glDrawElements:/home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.c:13: error: undefined reference to 'glDrawElements'

Error:Execution failed for task ':andEngine:compileReleaseNdk'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command: /home/uhu/android-ndk-r9d/ndk-build NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/Android.mk APP_PLATFORM=android-15 NDK_OUT=/home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj NDK_LIBS_OUT=/home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/lib APP_ABI=all Error Code: 2 Output: /home/uhu/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/objs/andengine_shared//home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.o: in function Java_org_andengine_opengl_GLES20Fix_glVertexAttribPointer:/home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.c:9: error: undefined reference to 'glVertexAttribPointer' /home/uhu/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/objs/andengine_shared//home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.o: in function Java_org_andengine_opengl_GLES20Fix_glDrawElements:/home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.c:13: error: undefined reference to 'glDrawElements' collect2: ld returned 1 exit status make: * [/home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/libandengine_shared.so] Error 1

Does anyone know how to fix this? Or if I'm just using the wrong tools, what can you recommend?

Rachel Gallen
  • 27,943
  • 21
  • 72
  • 81
user3387542
  • 611
  • 1
  • 8
  • 28
  • I would also like to know the answer. ndk-build does execute though only after specifying APP_PLATFORM := android-xx in Application.mk. But no luck with gradlew build. – Lakshman Chilukuri Jul 08 '14 at 18:43

2 Answers2

2

I managed to get my project to compile. The problem seems to me that AS and ndk dont work together well yet. Any case check my blog on setting up the project:-

AS and AndEngine setup

Lakshman Chilukuri
  • 1,067
  • 2
  • 11
  • 20
  • What do mean by the last step please could you ellaborate. Thankyou – therealprashant Dec 27 '14 at 18:38
  • I tried to follow this, but it didn't have enough detail on how to correctly import the different projects into And. Studio. I guess the post assumes someone knows how to correctly setup the projects dependencies there..? Given that this setup is non-trivial, would be nice to have all the details for someone like myself who is doing this kind of setup for the first time. Thanks for getting something started though – Gene Bo May 04 '15 at 19:09
0

It seems to be easier using the official intellij version instead of android studio. And as both are very similar in use, it't doesn't really matter. Together with some ndk-build hints from the answer of lakshman5876, it finally worked very well. Thanks http://www.jetbrains.com/idea/

user3387542
  • 611
  • 1
  • 8
  • 28