[SOLVED] Mac OS X Lion install problems - Android build, GLES compile errors

Hi,

I’m guessing I missed a step in the installation process somewhere, but I’ve installed this on my Lion system:

cocos2d-1.0.1-x-0.9.2
Android NDK (r5-crystax)
Android SDK (r15)

I’ve successfully installed the cocos2d-x templates and built an iOS project using them with Xcode 4.2.
I’ve successfully built test.android

I’ve created a new Android project using create-android-project.sh.
When I build it, I get errors like the following, all indicating that the compiler has no idea where the GLES support is.

I’m not sure where to correct this. Did I miss an obvious step when I set things up?

In file included from /Cocos2d-X/SimpleGame/android/jni/../../../cocos2dx/include/CCGL.h:25, from /Cocos2d-X/SimpleGame/android/jni/../../../cocos2dx/CCConfiguration.h:31, from /Cocos2d-X/SimpleGame/android/jni/../../../cocos2dx/CCConfiguration.cpp:26: /Cocos2d-X/SimpleGame/android/jni/../../../cocos2dx/platform/CCGL.h:58:21: error: GLES/gl.h: No such file or directory /Cocos2d-X/SimpleGame/android/jni/../../../cocos2dx/platform/CCGL.h:59:24: error: GLES/glext.h: No such file or directory In file included from /Cocos2d-X/SimpleGame/android/jni/../../../cocos2dx/include/CCGL.h:25, from /Cocos2d-X/SimpleGame/android/jni/../../../cocos2dx/CCConfiguration.h:31, from /Cocos2d-X/SimpleGame/android/jni/../../../cocos2dx/CCConfiguration.cpp:26: /Cocos2d-X/SimpleGame/android/jni/../../../cocos2dx/platform/CCGL.h:150: error: variable or field 'gluLookAt' declared void /Cocos2d-X/SimpleGame/android/jni/../../../cocos2dx/platform/CCGL.h:150: error: 'GLfloat' was not declared in this scope /Cocos2d-X/SimpleGame/android/jni/../../../cocos2dx/platform/CCGL.h:150: error: 'GLfloat' was not declared in this scope

…many many more, all GLES-related.

Please refer
http://www.cocos2d-x.org/boards/10/topics/5271

I think you should use official NDK toolchain, not crystax version.

Thanks, from the set-up tutorials I thought I needed to use the other NDKs.

I tried using the r7 NDK but got the errors that are seen on that post you provided. When I used the official r6b NDK from:

http://dl.google.com/android/ndk/android-ndk-r6b-darwin-x86.tar.bz2

with the r17 SDK, I was able to compile without the GLES errors. After some more fussing with Eclipse, I was able to run the sample application.

Thanks for your help.

Edit: solved

Same problem on windows to build android project. And I found what the problem is.

The TARGET in file “android\libs\armeabi\gdb.setup” is android-3

set solib-search-path E:/Workspace/game/project_a/cocos2d-1.0.1-x-0.9.2/DoodleDrop/android/obj/local/armeabi
directory E:/Android/android-ndk-r5/platforms/*android-3*/arch-arm/usr/include ......

And there is no folder of GLES in “android-ndk-r5\platformsandroid-3**~~arm\usr\include".
The gdb.setup is built by file android-ndk-r5\build\core\add-application.mk
<pre>
APP_PLATFORM := $)
ifndef APP_PLATFORM
local_props := $/*default.properties*))
ifdef
local_props
APP_PLATFORM := $~~f $/extract-platform.awk < $))
$ in $)
else
APP_PLATFORM :=**android-3*
$(call ndk_log, Defaulted to APP_PLATFORM=$(APP_PLATFORM))
endif
endif
</pre>
Notice it used”default.properties" here. But we have a “project.properties” not “default.properties” under OUR_PROJECT\android folder. So we got a TARGET “android-3”.

So the solution is:

  1. Add a new file “default.properties” under YOUR_PROJECT\android folder whit this:

    Project target.

    target=android-9

  2. Or use official r6b NDK http://dl.google.com/android/ndk/android-ndk-r6b-windows.zip as Dave said because this version add-application.mk has been changed:

    APP_PLATFORM := $(strip $(APP_PLATFORM))
    ifndef APP_PLATFORM
    _local_props := $(strip $(wildcard $(APP_PROJECT_PATH)/project.properties))
    ifndef _local_props
    # NOTE: project.properties was called default.properties before
    _local_props := $(strip $(wildcard $(APP_PROJECT_PATH)/default.properties))
    endif
    ifdef _local_props
    APP_PLATFORM := $(strip $(shell $(HOST_AWK) -f $(BUILD_AWK)/extract-platform.awk $(_local_props)))
    $(call ndk_log, Found APP_PLATFORM=$(APP_PLATFORM) in $(_local_props))
    else
    APP_PLATFORM := android-3
    $(call ndk_log, Defaulted to APP_PLATFORM=$(APP_PLATFORM))
    endif
    endif

i have downloaded the ndk-r8, and sdk-r18, followed tutorial, all goes well till i write build_native.sh in the cocos2d project folder, it compiles well without errors.
when i import in eclipse the project i have this:


some red cross on those files, what can i do?
thanks