Error compiling to run android

I am now starting with coconuts and am trying to build my first project for android, however I followed the tutorial to compile the cpp-tests errors occurred, also tried to create a new project and compile and it is also happening the same errors as below, anyone know what can it be?

I use windows 8, cocos2d-x-3.2, and try to run android

11:59:30 **** Incremental Build of configuration Release for project MyGame ****
python F:/Temp/MyGame/proj.android/build_native.py -b release all 
Android NDK: WARNING:jni/../../cocos2d/cocos/./Android.mk:cocos2dx_static: LOCAL_LDLIBS is always ignored for static libraries    
Android NDK: WARNING:jni/../../cocos2d/cocos/platform/android/Android.mk:cocos2dxandroid_static: LOCAL_LDLIBS is always ignored for static libraries    
make.exe: Entering directory `F:/Temp/MyGame/proj.android'
[armeabi] Compile++ thumb: cocos2dx_static <= CCBundleReader.cpp
[armeabi] Compile++ thumb: cocos2dx_static <= CCGLViewProtocol.cpp
[armeabi] Compile++ thumb: cocos2dx_static <= CCFileUtils.cpp
[armeabi] Compile++ thumb: cocos2dx_static <= CCSAXParser.cpp
jni/../../cocos2d/cocos/./3d/CCBundleReader.cpp:94:23: error: return type of out-of-line definition of 'cocos2d::BundleReader::tell' differs from that in the declaration
ssize_t BundleReader::tell()
                      ^
jni/../../cocos2d/cocos/./3d/CCBundleReader.h:90:14: note: previous declaration is here
    long int tell();
             ^
1 error generated.
make.exe: *** [obj/local/armeabi/objs/cocos2dx_static/3d/CCBundleReader.o] Error 1
make.exe: *** Waiting for unfinished jobs....
make.exe: Leaving directory `F:/Temp/MyGame/proj.android'
The Selected NDK toolchain version was 4.8 !
Traceback (most recent call last):
  File "F:/Temp/MyGame/proj.android/build_native.py", line 159, in <module>
    build(opts.ndk_build_param,opts.android_platform,opts.build_mode)
  File "F:/Temp/MyGame/proj.android/build_native.py", line 146, in build
    do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)
  File "F:/Temp/MyGame/proj.android/build_native.py", line 82, in do_build
    raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")
Exception: Build dynamic library for project [ F:\Temp\MyGame\proj.android ] fails!

It’s cause ssize_t is a different type than long int.

Are you sure, that you are using 3.2 Release, as it is declared as ssize_t tell(); with that version.

Update to 3.2 Release or change it by hand to ssize_t tell(); in CCBundleReader.h

I downloaded yesterday, 15/09 file name cocos2d-x-3.2.zip, looked a post that talked the link below to use the ndk9, I downloaded it, but in another compilation error occurs.

Using ndk 9 the error occurs below

18:32:21 **** Build of configuration Release for project MyGame ****
python F:/Temp/MyGame/proj.android/build_native.py -b release all 
Android NDK: Invalid APP_STL value: c++_static    
F:/Softwares/cocos-x/android-ndk-r9/build/core/add-application.mk:254: *** Android NDK: Aborting    .  Stop.
Traceback (most recent call last):
Android NDK: Please use one of the following instead:  system stlport_static stlport_shared gnustl_static gnustl_shared gabi++_static gabi++_shared none    
  File "F:/Temp/MyGame/proj.android/build_native.py", line 159, in <module>
    build(opts.ndk_build_param,opts.android_platform,opts.build_mode)
  File "F:/Temp/MyGame/proj.android/build_native.py", line 146, in build
    do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)
  File "F:/Temp/MyGame/proj.android/build_native.py", line 82, in do_build
    raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")
Exception: Build dynamic library for project [ F:\Temp\MyGame\proj.android ] fails!
make: Entering directory `F:/Temp/MyGame/proj.android'
make: Leaving directory `F:/Temp/MyGame/proj.android'
The Selected NDK toolchain version was 4.8 !

IQD Hello, thanks for your help :slight_smile:

And I did what you said and changed the CCBundleReader.h file for ssize_t tell ();

At compile time occurred some errors as below, but my application worked on android :slight_smile:

In file included from F:/Softwares/cocos/android-ndk-r10/sources/cxx-stl/llvm-libc++/libcxx/include\__locale:21:
In file included from F:/Softwares/cocos/android-ndk-r10/sources/cxx-stl/llvm-libc++/../../android/support/include\locale.h:38:
F:/Softwares/cocos/android-ndk-r10/platforms/android-9/arch-arm/usr/include\locale.h:55:1: warning: empty struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]
struct lconv { };
^
[armeabi] Compile thumb  : chipmunk_static <= cpBody.c

In file included from F:/Softwares/cocos/android-ndk-r10/sources/cxx-stl/llvm-libc++/../../android/support/include\locale.h:38:
F:/Softwares/cocos/android-ndk-r10/platforms/android-9/arch-arm/usr/include\locale.h:55:1: warning: empty struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]
struct lconv { };
^
[armeabi] Compile++ thumb: cocos2dxandroid_static <= TouchesJni.cpp
1 warning generated.
[armeabi] Compile thumb  : cpufeatures <= cpu-features.c

They fixed it in the github repo.
Guess I fixed it myself back then :smile:.

ndk 9 does not support c++_static as APP_STL.

In Application.mk set it to gnustl_static:

APP_STL := gnustl_static

Did you already change it, or did you compile with ndk 10?

Those are not errors, just warnings. So your code will compile fine.

Hi,

Sorry, I’m compiling with ndk 10 :smile:

Now I can start my application, the next step is to use SQLite :slight_smile:

I was trying to use cocos2d JS, but it seems very complicated to use SQLite with him, I will become the cocos-x :slight_smile:

Thank you for your help :slight_smile: