0
votes

Since night, i am trying to setup andEngine with android studio,

  1. I downloaded andEngine from GITHub https://github.com/nicolasgramlich/AndEngine GLES- Anchor Center..

  2. I installed NDK from SDK Manager (in adroid studio)

  3. Then, i created the new Project in android studio (Blank activity) and then i went to Project Structure and Clicked on + on left side and added "Import Eclipse ADT project" -> and Select the downloaded andEngine (from GitHub) and finish

  4. then i got the error " NDK depcrecated " which is resolved by adding the following line in gradle.properties 'android.useDeprecatedNdk = true'

  5. then try to syn again, then i got the below error, i dont know what to do now.. Please help me resolve it..

    Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :andEngine:generateDebugSources, :andEngine:generateDebugAndroidTestSources] :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :andEngine:preBuild UP-TO-DATE :andEngine:preReleaseBuild UP-TO-DATE :andEngine:compileReleaseNdk C:\Users\Amul\AndroidStudioProjects\MyApplication2\andEngine\src\main\jni\src\GLES20Fix.c: In function 'Java_org_andengine_opengl_GLES20Fix_glVertexAttribPointer': glVertexAttribPointer(index, size, type, normalized, stride, (void*) offset); ^ C:\Users\Amul\AndroidStudioProjects\MyApplication2\andEngine\src\main\jni\src\GLES20Fix.c: In function 'Java_org_andengine_opengl_GLES20Fix_glDrawElements': glDrawElements(mode, count, type, (void*) offset); ^ C:\Users\Amul\AndroidStudioProjects\MyApplication2\andEngine\build\intermediates\ndk\release\obj/local/arm64-v8a/objs/andengine_shared/C_\Users\Amul\AndroidStudioProjects\MyApplication2\andEngine\src\main\jni\src\GLES20Fix.o: In function Java_org_andengine_opengl_GLES20Fix_glVertexAttribPointer': C:\Users\Amul\AndroidStudioProjects\MyApplication2\andEngine\build\intermediates\ndk\release\obj/local/arm64-v8a/objs/andengine_shared/C_\Users\Amul\AndroidStudioProjects\MyApplication2\andEngine\src\main\jni\src\GLES20Fix.o: In functionJava_org_andengine_opengl_GLES20Fix_glDrawElements': C:\Users\Amul\AndroidStudioProjects\MyApplication2\andEngine\src\main\jni\src\GLES20Fix.c Warning:(9, 63) warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] Warning:(13, 36) warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] Error:(9) undefined reference to glVertexAttribPointer' Error:(13) undefined reference toglDrawElements' Error:error: ld returned 1 exit status make: *** [C:\Users\Amul\AndroidStudioProjects\MyApplication2\andEngine\build\intermediates\ndk\release\obj/local/arm64-v8a/libandengine_shared.so] Error 1 Error:Execution failed for task ':andEngine:compileReleaseNdk'.

    com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Amul\AppData\Local\Android\sdk\ndk-bundle\ndk-build.cmd'' finished with non-zero exit value 2 Information:BUILD FAILED Information:Total time: 7.815 secs Information:4 errors Information:2 warnings Information:See complete output in console

1
The undefined references are both symbols in OpenGL, so the dependency isn't getting resolved somehow. Are you linking to OpenGL in your project? Please post Android.mk (if you use it) and build.gradle.Francesca Nannizzi

1 Answers

0
votes

Probably native libraries (.so files from lib dir) are missing.

If you're using android studio, you have to modify andEngine build.gradle.

Add sourceSets block to your andEngine build.gradle file :

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

After adding your andEngine build.gradle file become :

apply plugin: 'com.android.library'

    android {
        compileSdkVersion 20
        buildToolsVersion "23.0.3"

        defaultConfig {
            minSdkVersion 17
            targetSdkVersion 23

            ndk {
                moduleName "andengine_shared"
            }
        }

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

        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
        }  
    }

Hopefully it may be helpful otherwise tell me the result.