Cocos2d-x 3.13.1: error with cocos run (Android) - android

:-)
I moved to Cocos2d-x 3.13.1 from a couple of days (I moved from 3.12).
My game works great when compiled for Linux.
When however I try to execute my game on my Android device I get this:
drk#drk-pc ~/cocos2d-projects/SpaceRush $ cocos run -p android --android-studio
Building mode: debug
Using Android Studio project : /home/drk/cocos2d-projects/SpaceRush/proj.android-studio
running: '/home/drk/Android/Sdk/tools/android update project -t android-19 -p /home/drk/cocos2d-projects/SpaceRush/proj.android-studio/app'
Updated project.properties
Updated local.properties
Updated file /home/drk/cocos2d-projects/SpaceRush/proj.android-studio/app/proguard-project.txt
Building native...
NDK build mode: debug
running: '/home/drk/Android/android-ndk-r12b/ndk-build -C /home/drk/cocos2d-projects/SpaceRush/proj.android-studio/app -j12 NDK_MODULE_PATH=/home/drk/cocos2d-projects/SpaceRush/proj.android-studio/../cocos2d:/home/drk/cocos2d-projects/SpaceRush/proj.android-studio/../cocos2d/cocos:/home/drk/cocos2d-projects/SpaceRush/proj.android-studio/../cocos2d/external NDK_TOOLCHAIN_VERSION=4.9 NDK_DEBUG=1'
make: ingresso nella directory "/home/drk/cocos2d-projects/SpaceRush/proj.android-studio/app"
/home/drk/Android/android-ndk-r12b/build/core/build-module.mk:34: *** missing separator. Arresto.
make: uscita dalla directory "/home/drk/cocos2d-projects/SpaceRush/proj.android-studio/app"
Error running command, return code: 2.
I don't know how to solve this problem, I'm not an Android build expert!
I tried to compile both with NDK 11c and 12b.
Thanks for your help

Try a different NDK, possible 10e.

Related

Cocos2d-x error while compiling LOCAL_SRC_FILES points to a missing file (and folder) Windows

Good evening.
I'm stuck trying to compile a HelloWorld using the cocos2d-x.
I used the following commands:
cocos compile -p android --android-studio
cocos compile -p android --android-studio
cocos compile -p android
And I always had the same answer
Android NDK: ERROR:C:\Users\santi_000\Desktop\Android\cocos2d\HelloWorld\proj.android\../cocos2d/external/freetype2/prebuilt/android/Android.mk:cocos_freetype2_static: LOCAL_SRC_FILES points to the missing file
Android NDK: Check que C:/Users/santi_000/Desktop/Android/cocos2d/HelloWorld/proj.android/../cocos2d/external/freetype2/prebuilt/android/arm64-v8a/libfreetype.a exists or que its path is correct
make: Entering directory `C: /Users/santi_000/Desktop/Android/cocos2d/HelloWorld/proj.android '
C: / Users / santi_000 / AppData / Local / Android / sdk / ndk-bundle / build //../ build / core / prebuilt-library.mk: 45: *** Android NDK: Aborting. Stop.
make: Leaving directory `C: /Users/santi_000/Desktop/Android/cocos2d/HelloWorld/proj.android '
Error running command, return code: 2.
I found some pages here in StackOverFlow however none of them helped me. I'm using Windows. I realized I do not even have the arm64-V8A folder, what do I do? Where I can copy it, or how can I generate it?
Thank you.
The following worked for me
cocos compile --android-studio --target android-22
--ap android-22 --ndk-mode debug --ndk-toolchain arm-linux-androideabi-4.9
--platform android --app-abi armeabi --src C:\cocos2d-x\tests\cpp-tests
You will need to replace the --ndk-toolchain to the proper one that comes with your NDK installation. Check in the toolchains folder inside NDK_ROOT.
The most important one that actually got it working was --app-abi armeabi as that is what was the toolchain used.
[Edit]
If you actually check cocos compile -h you will see that --app-abi mentions armeabi as the default. But that is not the case. It is picking up arm64 as the default.
First of all, the commands to compile the android project starts with cocos not coconuts.
cocos compile -p android --android-studio
or
cocos compile -p android
Now, for the above error, it seems, you haven't set NDK_HOME path in environment variable.
You can set it manually or goto your cocos2d-x library folder from terminal and run
./setup.py
It will do the rest.

ndk-gdb cannot find gdb.setup but it is there under x86

Cocos2d-x 3.7.1 + ndk r10e project on Mac trying to debug in Eclipse. Days pass and the errors keep coming...
I can build and run using cocos compile and cocos run with -p android -m debug --ndk-mode NDK_DEBUG=1 from the terminal in proj.android.
My app runs Ok (eventually) on my x86 emulator no problem.
Typing 'ndk-gdb' in the terminal from ./proj.android and I get the error
ERROR: Could not find gdb.setup under ./libs/
BUT the file gdb.setup (and gdbserver & libcocos2dcpp.so) can be seen in ./proj.android/libs/x86 !?
My AndroidManifest.xml includes android:debuggable="true"
My jni/Application.mk includes APP_ABI := x86 (only)
If anyone can tell me how I can diagnose or fix this problem then I guess I owe them a beer (in Yorkshire btw)
UPDATE: I have tried running up GDB using the --verbose flag. The output shows
Using gdb setup init: ./libs/armeabi/gdb.setup
Using app out directory: ./obj/local/armeabi
Guess I need to change to settings/init file somewhere??
I ran into the same problem. It seems something changed in recent version of Android Build tools.
The trick is:
ERROR: Could not find gdb.setup under ./libs/
It expects gdb.setup is in the directory libs but NOT libs/armeabi
so the simple workground is to copy gdb.setup and gdbserver from "libs/cpu" to "libs" and it works like a magic!
This is a bug caused by adb from android sdk.Issue 191085: ndk-gdb issue - Could not find gdb.setup under ./libs/ (even though it's there)
Currently previewl channel's adb whose version is 1.0.35 still has the same problem.
Without revert adb to 1.0.31.A simple workaround would be modify ndk-gdb a little: change the line if [ $? = 0 ]; then which is below adb_var_shell BCFILES run-as $PACKAGE_NAME /system/bin/sh -c "ls lib/*.bc" to if [ $? = 1 ]; then

cocos2d-x 3.0 rc0 : develop for android in eclipse

I'm on windows xp & Eclipse Kepler. I want to develop with cocos2d-x, but I have some problem.
First, I created project.
cocos new MyGame -p com.myprog.MyGame -l cpp -d MyGame
and I tried run:
cd MyGame
cocos run -s MyGame -p android
and it succeeded.
The problem happens when I open it by eclipse. I create eclipse project, Android Project From Existing Code.
But I can't know what to do next.. even I don't know how to build! (Project - Build doesn't work..)
Moreover, Classes, cocos2dx, extensions and scripting folder are broken..
I tried to find solution, but people are saying about only cocos2d-x 2.x ...
Even if README.md seems to say about 2.x!
Could anyone tell me how do I do?
Installation Process:
Cocos2d require NDK and Cygwin
First install NDK ->
This links may help you :
http://nikhilvithlani.blogspot.in/2013/07/install-android-ndk-for-windows_6.html
Cocos 2d installation link:
http://www.cocos2d-x.org/wiki/How_to_set_up_the_android_cocos2d-x_development_environment_on_Windows_7
Download cocos 2d version and follow the instruction in above link
This packages you required in cygwin: search and install:
autoconf, automake, binutils, gcc-core, gcc-g**, gcc4-core, gcc4-g**, gdb, pcre, pcre-devel, gawk, make
After installation cygwin,ndk and you need to config in C/C++ preference in eclipse(Don't forget to install c/c++ plugin in eclipse)
My NDK and PATH is :
NDK_ROOT->C:/android-ndk-r9c
PATH->C:\android-ndk-r9c;C:\Cygwin\bin;
Then import the sample project :
cocos2d-x-2.2.2\samples\Cpp\HelloCpp\proj.android
Import the library :
cocos2d-x-2.2.2\cocos2dx\platform\android\java
Add the library to hello world project
when you import hello world project eclipse automatically include the header files:
bash F:/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android/build_native.sh
cygwin warning:
MS-DOS style path detected: F:\cocos2d-x-2.2.2\samples\Cpp\HelloCpp\proj.android
Preferred POSIX equivalent is: /cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
NDK_ROOT = C:/android-ndk-r9c
COCOS2DX_ROOT = /cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android/../../../..
APP_ROOT = /cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android/..
APP_ANDROID_ROOT = /cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android
Using prebuilt externals
+ C:/android-ndk-r9c/ndk-build -C /cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android NDK_MODULE_PATH=/cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android/../../../..:/cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android/../../../../cocos2dx/platform/third_party/android/prebuilt
make: Entering directory '/cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android'
Android NDK: WARNING: APP_PLATFORM android-9 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
Android NDK: WARNING:/cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android/../../../../cocos2dx/Android.mk:cocos2dx_static: LOCAL_LDLIBS is always ignored for static libraries
[armeabi] Install : libhellocpp.so => libs/armeabi/libhellocpp.so
make: Leaving directory '/cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android'
After get output in console right click project and goto properties and choose paths and symbols under c/c++ general
Run the project and you can see the output :
Useful links:
http://www.youtube.com/watch?v=2itbQceTQGI
You can handle it in different way though you are on windows you have to use Microsoft Visual Studio Express 2012 for Windows Desktop its free and also it will give you good IntelliSense support.
Every time you edit using MS VS2012 run proj.android/build_native.py and then you can run your app from eclipse as usual.

Android NDK arm-linux-androideabi-g++: error

I am trying to compile android-NDK project which uses L2CAP Bluetooth profile.When I compile in eclipse with android-ndk-r8d-windows and android-sdk-4.2 I am getting following error
arm-linux-androideabi-g++: error: libbluetooth.so: No such file or directory
make: *** [obj/local/armeabi/libl2cap_BTComm.so] Error 1
Please help me in solving this
I got the same problem in Ubuntu 12.04 while building the ndk project using ndk-build.
The problem is the missing g++ compiler. After install a GNU C++ compiler it works now.
Interestingly, when I recompile the whole project from fresh it got the same complain again.
(before I was using cygwin and ubuntu to compile the same project and it was working)
Its been over a year now since the last reply but I think the answer is to use the -l option of g++ to add the directory with the lib to g++'s search paths.

android ndk-build error on ubuntu 12.10 32 bit

i have downloaded the latest android ndk r8b on my ubuntu 12.10 beta 2 .
i have included the ndk directory in the PATH variable (when i write ndk-b in terminal and hit tab it auto-completes it) .
but when i try :
cd android-ndk/samples/san-angeles/jni
ndk-build
i get this error:
make: /home/mixpro/Android/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Command not found
make: /home/mixpro/Android/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Command not found
Compile thumb : sanangeles <= importgl.c
make: /home/mixpro/Android/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc: Command not found
make: *** [/home/mixpro/Android/android-ndk/samples/san-angeles/obj/local/armeabi/objs/sanangeles/importgl.o] Error 127
when checking the /android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin directory using ls i get:
arm-linux-androideabi-addr2line arm-linux-androideabi-g++
arm-linux-androideabi-gdbtui arm-linux-androideabi-size
arm-linux-androideabi-c++filt arm-linux-androideabi-gcc-4.6.x-google
arm-linux-androideabi-gprof arm-linux-androideabi-strings
arm-linux-androideabi-cpp arm-linux-androideabi-gcov
arm-linux-androideabi-readelf arm-linux-androideabi-elfedit
arm-linux-androideabi-gdb arm-linux-androideabi-run
meaning there is no arm-linux-androideabi-gcc in the directory
I am afraid that somehow you got arm-linux-androideabi-addr2line arm-linux-androideabi-gcc deleted. On linux, it is just a symlink to arm-linux-androideabi-gcc-4.6.x-google, so it's very easy to restore it. But maybe, to be on the safe side, it's worthwhile to reinstall NDK.
you should create symbolic link like this : ln -s /usr/bin/arm-linux-gnueabi-gcc-4.7 "/home/sofien/Bureau/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc"

Categories

Resources