【Cocos2d-x3.0 Made easy】 (Lesson1)How to Run Cocos2D-X Samples on Android

@yuye
Ok…
I read somewhere in the forum, that if the app is crashing, then possibiity is of missing libxxx.so file under \proj.android\libs\armeabi
And this file was actually not present there.

But, it wasn’t there for those too when I used to run in cocos2d-x v2.2.2
Anyways, if you say so, that it will run on actual device, then fine… :;ok

@yuye wrote:

@batymahn u can not use build_native
you must use command line with
cocos run -p android

But…I tried with both, and it gave same results… :;ok

@catch_up you need add this into eclipse:
Myproject/cocos2d/cocos/2d/platform/android/java

@yuye
Hmmm… yes I added the link to Myproject/cocos2d/cocos/2d/platform/android/java/src in the project properties… Anyways, it worked… But, I am not sure, whether it’ll work without adding it into eclipse…

@catch_up you can try this two steps


I’m using xcode for developement and terminal for build with the following code:

cocos deploy -p android debug

and my app is crash out all the time. and i got the following message in ddms:

04-30 09:28:57.398: E/InputDispatcher(510): channel '42461d38 com.xxx.yyy/org.cocos2dx.cpp.AppActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 04-30 09:55:10.018: W/ActivityManager(510): Force finishing activity com.xxx.yyy/org.cocos2dx.cpp.AppActivity 04-30 09:55:10.028: I/WindowState(510): WIN DEATH: Window{42461d38 u0 com.xxx.yyy/org.cocos2dx.cpp.AppActivity} 04-30 09:55:10.038: I/ActivityManager(510): Process com.xxx.yyy (pid 5690) has died.

@steknika do you want to deploy your code to gitHub?
or just want to complile it

i just want to compile and run on my device

i also tried cocos run -p android debug but the same result comes up :S

is my manifest if ok?

i’m just showing the line im not sure… the package name isn’t need to be equal with the activity bundle?

.....etcetcetc
      package="com.xxx.yyy"
      android:versionCode="1"
      android:versionName="1.0">
........etcetc
        activity android:name="org.cocos2dx.cpp.AppActivity"
                  android:label="@string/app_name"
                  android:screenOrientation="landscape"
                  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                  android:configChanges="orientation">
........etcetc
            <!-- Tell NativeActivity the name of our .so -->
            meta-data android:name="android.app.lib_name"
                       android:value="cocos2dcpp"
........etcetc

05-02 12:40:48.746: W/ActivityManager(510): Force finishing activity com.xxx.yyy/org.cocos2dx.cpp.AppActivity

is this good? I mean com.xxx.yyy/org.cocos2dx.cpp.AppActivity this… is it look correct?

@steknika why do not use following command

cocos run -p ios

because i want to deploy it on an android device. on ios it works perfect. on windows it works perfect too. but on android it said Unfortunatel, xxx game has stopped on startup.

I added the cpp files to Android.mk do all the necesery steps and I just still don’t get it what could posibly cause this problem.

by the way, thanks all your help! :slight_smile:

UPDATE / RESOLVED:

**After a long debug process i found that the problem is an initalization in my mainmenu class.

it was:
Label *btn …

i changed it to:
auto *btn …

and it’s finaly works…**

thanks for the help! :slight_smile:

@steknika did u check you .mk files is ok? maybe you added some .cpp files into your project?

I got this error:

make: Leaving directory `/Users/iko/Lib/cocos2d-x-3-2.4/tests/cpp-tests/proj.android'
sh: :/Users/iko/Library/Android/sdk/tools/android: No such file or directory
update cocos lib-project [ /Users/iko/Lib/cocos2d-x-3-2.4/build/../cocos/platform/android/java ] fails!

but /Users/iko/Library/Android/sdk/tools/android exists.
Any help please?