NatWeiss / RapidGame

A commandline tool for Windows, Mac and Linux that prebuilds cocos2d-x static libraries. Also a cross-platform game templating system.
https://github.com/NatWeiss/RapidGame
MIT License
139 stars 22 forks source link

Android Crash on Startup #30

Closed FramusRock closed 8 years ago

FramusRock commented 9 years ago

Hello,

I tried RapidGame for the first time today and I really love the idea behind it.

It's running fine for me on iOS and everything is cool, but on android I get an instant crash when starting the app.

I'm using the ndk-r9d and Java 8. Testing is done on a Nexus 7 Tablet, with Android 4.4.1.

This is what the Terminal says: F/libc ( 5477): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)

While compiling with make, the following is printed to console:


APP_CPPFLAGS=-frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -DCOCOS2D_JAVASCRIPT -DCOCOS2D_DEBUG=1

Android NDK: WARNING:jni/Android.mk:cocos2dxgame_shared: non-system libraries in linker flags: jni/../../../lib/cocos2d/x/lib/Debug-Android/armeabi/libz.a -lpng -ljpeg -ltiff -lwebp -lcurl -lssl -lcrypto -lfreetype -ljs_static -lwebsockets -lchipmunk

Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module


Especially this sounds scary: This is likely to result in incorrect builds.

Do you have an idea what's causing the instant crash on android?

NatWeiss commented 9 years ago

The paths to everything changed in the latest release of cocos2d-x and I had to work some Android linker magic in Projects/android/jni/Android.mk to get things compiling again. There's a chance this is what is causing the runtime crash and there's also a chance it is something else (as all these external libs are taken straight from cocos2d-x' external folder).

Reference: http://stackoverflow.com/questions/25663989/warning-android-mk-non-system-libraries-in-linker-flags

If it is not the libraries then it may be something else they changed in the way the Android projects are now being built. In this case I would systematically check all the files in Projects/android looking for key differences versus the default project the cocos command generates.

If it is the libraries, then I would try the technique listed in the link above.

Sorry I won't have time to address any of this until next release. Please share on this thread if you discover anything in the meantime! :)

FramusRock commented 9 years ago

Thanks for you response.

I haven't really found anything new yet, but will post if I do.

Using the default cocos2d-x setup, I was able to get something to run on Android for the first time ( at least this ). I've got some more questions and hope you can help me:

1) Is it possible to use RapidGame with an older version of cocos2d-x? I wouldn't mind not beeing on the newest version, but I'd really like to be able to just use it. If yes, which version would that be?

2) Is it possible to (only) use RapidGame to update my Android / Windows / Linux, etc. Makefiles? I'm just trying to use the default cocos2d-x project template. Then I added a cpp file in Xcode, but of course the Android makefile was not aware of it and it won't compile there. Changing all these by hand is very tedious, and I think this is also one of your major reasons to make Rapidgame ;)

If you have any more advice, it is very appreciated :)

FramusRock commented 9 years ago

Here's something new that it spit out when I run "make run" for my android device. I have no idea if it helps though.

Maxs-MBP:android Max$ make run adb -d install -r bin/cat .name-debug.apk 1295 KB/s (7049669 bytes in 5.314s) pkg: /data/local/tmp/RapidGameTest-debug.apk Success adb -d logcat -v brief cat .identifier:D *:F --------- beginning of /dev/log/system --------- beginning of /dev/log/main F/ActivityManager( 506): Activity Manager Crash F/ActivityManager( 506): java.lang.IllegalArgumentException: Call does not support special user #-1 F/ActivityManager( 506): at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:12718) F/ActivityManager( 506): at com.android.server.am.ActivityManagerService.getContentProvider(ActivityManagerService.java:7802) F/ActivityManager( 506): at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:704) F/ActivityManager( 506): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2071) F/ActivityManager( 506): at android.os.Binder.execTransact(Binder.java:404) F/ActivityManager( 506): at dalvik.system.NativeStart.run(Native Method) F/libc (11616): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 11616 (g.RapidGameTest)

FramusRock commented 9 years ago

I think I found something pretty close to a solution. This guy here explains how everything needs to be setup for prebuilt cocos2d libraries with the newest version.

http://discuss.cocos2d-x.org/t/how-to-speed-up-cocos2d-x-build-with-prebuilt-lib/23402

NatWeiss commented 9 years ago

To answer your questions:

1) In theory you can use whatever version or patched version of cocos2d-x you'd like by simply replacing the src/cocos2d-x folder, then prebuilding. In practice this only works with near versions. For example, cocos2d-x recently merged with cocos2d-js so all the paths changed, rendering old versions of RapidGame incompatible with new versions. If you'd like an old version you can:

npm view rapidgame versions
npm install -g rapidgame@0.9.10

2) Sorry, I don't know. @samoersnaes created a script for this purpose in templates/cocos2dx/TwoScene/Projects/android/build_files.py but I'm not sure how it works. You could try just running it.

Thanks for posting that link about gen-libs. Does it work for you?

NatWeiss commented 9 years ago

In regard to your comment about small FPS numbers, that's because the design res for the project is big.