I set up for android
–I have D:\archivosprogramad\cocos3xfiles\adt-bundle-windows-x86_64-20140624\sdk
–I have apache-ant-1.9.3
–cocos2d-x-3.2
–android-ndk-r10
I create the project without problems.
cocos new MyGamendkten -p com.your_company.mygame -l cpp -d
The problem is when I want to build MyGamendkten using “build_native.py”
I assume you have set the NDK_ROOT environment variable?
If so, you need to adapt build_native.py as android-ndk-r10 is using gcc 4.9 but the python script does not account for that:
ndk_root = check_environment_variables()
if os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.9")):
os.environ['NDK_TOOLCHAIN_VERSION'] = '4.9'
print "The Selected NDK toolchain version was 4.9 !"
elif os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.8")):
os.environ['NDK_TOOLCHAIN_VERSION'] = '4.8'
print "The Selected NDK toolchain version was 4.8 !"
elif os.path.isdir(os.path.join(ndk_root,"toolchains/arm-linux-androideabi-4.7")):
os.environ['NDK_TOOLCHAIN_VERSION'] = '4.7'
print "The Selected NDK toolchain version was 4.7 !"
else:
print "Couldn't find the gcc toolchain."
exit(1)
Add the code for 4.9(just copy&paste and change to 4.9) or just change 4.8 to 4.9 as an easy fix/hack.
variable name NDK_ROOT
variable value D:\archivosprogramad\cocos3xfiles\android-ndk-r10
I copy and paste the code, and I get this error
D:\archivosprogramad\cocos3xfiles\practicadecocos\MyGamendk10\proj.android>build
_native.py
The Selected NDK toolchain version was 4.9 !
Android NDK: WARNING: Rebuilding libc++ libraries from sources!
Android NDK: You might want to use $NDK/build/tools/build-cxx-stl.sh --stl=libc+
+
Android NDK: in order to build prebuilt versions to speed up your builds!
Android NDK: ERROR:D:/archivosprogramad/cocos3xfiles/android-ndk-r10/sources/and
roid/compiler-rt/Android.mk:compiler_rt_shared: LOCAL_SRC_FILES points to a miss
ing file
Android NDK: Check that D:/archivosprogramad/cocos3xfiles/android-ndk-r10/source
s/android/compiler-rt/libs/armeabi/libcompiler_rt_shared.so exists or that its
path is correct
make.exe: Entering directory D:/archivosprogramad/cocos3xfiles/practicadecocos/ MyGamendk10/proj.android' D:/archivosprogramad/cocos3xfiles/android-ndk-r10/build/core/prebuilt-library.mk :45: *** Android NDK: Aborting . Stop. make.exe: Leaving directoryD:/archivosprogramad/cocos3xfiles/practicadecocos/M
yGamendk10/proj.android’
Traceback (most recent call last):
File “D:\archivosprogramad\cocos3xfiles\practicadecocos\MyGamendk10\proj.andro
id\build_native.py”, line 162, in
build(opts.ndk_build_param,opts.android_platform,opts.build_mode)
File “D:\archivosprogramad\cocos3xfiles\practicadecocos\MyGamendk10\proj.andro
id\build_native.py”, line 149, in build
do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,and
roid_platform,build_mode)
File “D:\archivosprogramad\cocos3xfiles\practicadecocos\MyGamendk10\proj.andro
id\build_native.py”, line 85, in do_build
raise Exception(“Build dynamic library for project [ " + app_android_root +
" ] fails!”)
Exception: Build dynamic library for project [ D:\archivosprogramad\cocos3xfiles
\practicadecocos\MyGamendk10\proj.android ] fails!
Android NDK: ERROR:D:/archivosprogramad/cocos3xfiles/android-ndk-r10/sources/and
roid/compiler-rt/Android.mk:compilerrt_shared: LOCAL_SRC_FILES points to a miss
ing file
One of your source files cannot be found.
Please check/post the content of LOCAL_SRC_FILES in your project’s Android.mk file and make sure the files referenced do exist.