I have a simple app, but it crashes on any android device or simulator that i am targeting. It runs ok on iOS and WEB though. Using the cocos2djs 3.7.1, NDK r10e. Here is a stack trace and i can not figure out what is wrong:
D/cocos2d-x debug info( 3052):
D/cocos2d-x debug info( 3052): {
D/cocos2d-x debug info( 3052): gl.supports_vertex_array_object: false
D/cocos2d-x debug info( 3052): gl.supports_BGRA8888: false
D/cocos2d-x debug info( 3052): gl.supports_ATITC: false
D/cocos2d-x debug info( 3052): gl.supports_S3TC: false
D/cocos2d-x debug info( 3052): cocos2d.x.version: cocos2d-x-3.7
D/cocos2d-x debug info( 3052): gl.supports_discard_framebuffer: false
D/cocos2d-x debug info( 3052): cocos2d.x.compiled_with_profiler: false
D/cocos2d-x debug info( 3052): gl.supports_PVRTC: false
D/cocos2d-x debug info( 3052): cocos2d.x.build_type: DEBUG
D/cocos2d-x debug info( 3052): gl.renderer: PowerVR SGX 544MP
D/cocos2d-x debug info( 3052): gl.supports_ETC1: true
D/cocos2d-x debug info( 3052): cocos2d.x.compiled_with_gl_state_cache: true
D/cocos2d-x debug info( 3052): gl.version: 2.1 INTEL-10.6.31
D/cocos2d-x debug info( 3052): gl.supports_NPOT: true
D/cocos2d-x debug info( 3052): gl.max_texture_units: 16
D/cocos2d-x debug info( 3052): gl.vendor: Imagination Technologies
D/cocos2d-x debug info( 3052): gl.max_texture_size: 16384
D/cocos2d-x debug info( 3052): }
D/cocos2d-x debug info( 3052):
D/cocos2d-x debug info( 3052):
F/libc ( 3052): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=128), thread 3067 (Thread-153)
I/ActivityManager( 546): Displayed com.mkdigitalsolutions.puzzler/org.cocos2dx.javascript.AppActivity: +183ms (total +6s600ms)
I/DEBUG ( 154): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 154): Build fingerprint: 'andy/andy/andy:4.2.2/JDQ39E/eng.developer.20150116.074207:userdebug/test-keys'
I/DEBUG ( 154): Revision: '0'
I/DEBUG ( 154): pid: 3052, tid: 3067, name: Thread-153 >>> com.mkdigitalsolutions.puzzler <<<
I/DEBUG ( 154): signal 11 (SIGSEGV), code 128 (?), fault addr 00000000
D/SettingsProvider( 546): User 0 external modification to /data/data/com.android.providers.settings/databases/settings.db; event=8
D/SettingsProvider( 546): User 0 updating our caches for /data/data/com.android.providers.settings/databases/settings.db
I/DEBUG ( 154): eax b7aa4898 ebx 98c13934 ecx b7aa4898 edx 961e89f0
I/DEBUG ( 154): esi 961ecf34 edi 961e8b94
I/DEBUG ( 154): xcs 00000073 xds 0000007b xes 0000007b xfs 00000000 xss 0000007b
I/DEBUG ( 154): eip 97ffd06f ebp 961e88e8 esp 961e8260 flags 00010282
I/DEBUG ( 154):
I/DEBUG ( 154): backtrace:
I/DEBUG ( 154): #00 pc 01bb606f /data/app-lib/com.mkdigitalsolutions.puzzler-1/libcocos2djs.so (_ZN7cocos2d8MathUtil14multiplyMatrixEPKDv4_fS3_PS1_+105)
I/DEBUG ( 154): #01 pc 01a67083 /data/app-lib/com.mkdigitalsolutions.puzzler-1/libcocos2djs.so (cocos2d::Mat4::multiply(cocos2d::Mat4 const&, cocos2d::Mat4 const&, cocos2d::Mat4*)+163)
I/DEBUG ( 154): #02 pc 01a66fd8 /data/app-lib/com.mkdigitalsolutions.puzzler-1/libcocos2djs.so (cocos2d::Mat4::multiply(cocos2d::Mat4 const&)+44)
I/DEBUG ( 154): #03 pc 01a8755d /data/app-lib/com.mkdigitalsolutions.puzzler-1/libcocos2djs.so (cocos2d::Mat4::operator*=(cocos2d::Mat4 const&)+37)
I/DEBUG ( 154): #04 pc 01a897ea /data/app-lib/com.mkdigitalsolutions.puzzler-1/libcocos2djs.so (cocos2d::Director::multiplyMatrix(cocos2d::MATRIX_STACK_TYPE, cocos2d::Mat4 const&)+98)
I/DEBUG ( 154): #05 pc 01a89c9c /data/app-lib/com.mkdigitalsolutions.puzzler-1/libcocos2djs.so (cocos2d::Director::setProjection(cocos2d::Director::Projection)+512)
I/DEBUG ( 154): #06 pc 01a889ce /data/app-lib/com.mkdigitalsolutions.puzzler-1/libcocos2djs.so (cocos2d::Director::setGLDefaultValues()+232)
I/DEBUG ( 154): #07 pc 01a88f55 /data/app-lib/com.mkdigitalsolutions.puzzler-1/libcocos2djs.so (cocos2d::Director::setOpenGLView(cocos2d::GLView*)+419)
I/DEBUG ( 154): #08 pc 0096d0b0 /data/app-lib/com.mkdigitalsolutions.puzzler-1/libcocos2djs.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit+211)
I/DEBUG ( 154): #09 pc 0001ae60 /system/lib/libdvm.so (dvmPlatformInvoke+80)
I/DEBUG ( 154): #10 pc 0006f623 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+723)
I/DEBUG ( 154):
I/DEBUG ( 154): stack:
I/DEBUG ( 154): 961e8220 00000000
I/DEBUG ( 154): 961e8224 00000000
I/DEBUG ( 154): 961e8228 00000000
I/DEBUG ( 154): 961e822c 00000000
I/DEBUG ( 154): 961e8230 00000000
I/DEBUG ( 154): 961e8234 00000000
I/DEBUG ( 154): 961e8238 00000000
I/DEBUG ( 154): 961e823c 00000000
I/DEBUG ( 154): 961e8240 00000000
I/DEBUG ( 154): 961e8244 00000000
I/DEBUG ( 154): 961e8248 00000000
I/DEBUG ( 154): 961e824c 00000000
I/DEBUG ( 154): 961e8250 00000000
I/DEBUG ( 154): 961e8254 00000000
I/DEBUG ( 154): 961e8258 00000000
I/DEBUG ( 154): 961e825c 00000000
I/DEBUG ( 154): #00 961e8260 402ab600
I/DEBUG ( 154): 961e8264 402ab600
I/DEBUG ( 154): 961e8268 402ab600
I/DEBUG ( 154): 961e826c 402ab600
I/DEBUG ( 154): 961e8270 00000000
I/DEBUG ( 154): 961e8274 00000000
I/DEBUG ( 154): 961e8278 00000000
I/DEBUG ( 154): 961e827c 00000000
I/DEBUG ( 154): 961e8280 00000000
I/DEBUG ( 154): 961e8284 00000000
I/DEBUG ( 154): 961e8288 00000000
I/DEBUG ( 154): 961e828c 00000000
I/DEBUG ( 154): 961e8290 00000000
I/DEBUG ( 154): 961e8294 00000000
I/DEBUG ( 154): 961e8298 00000000
I/DEBUG ( 154): 961e829c 00000000
I/DEBUG ( 154): ........ ........
I/DEBUG ( 154): #01 961e88f0 b7aa4898 [heap]
I/DEBUG ( 154): 961e88f4 961e89f0 [stack:3067]
I/DEBUG ( 154): 961e88f8 b7aa4898 [heap]
I/DEBUG ( 154): 961e88fc 00000000
I/DEBUG ( 154): 961e8900 00000001
I/DEBUG ( 154): 961e8904 00000000
I/DEBUG ( 154): 961e8908 40000000
I/DEBUG ( 154): 961e890c b7aa3e70 [heap]
I/DEBUG ( 154): 961e8910 00000000
I/DEBUG ( 154): 961e8914 98c13934 /data/app-lib/com.mkdigitalsolutions.puzzler-1/libcocos2djs.so
I/DEBUG ( 154): 961e8918 961e8938 [stack:3067]
I/DEBUG ( 154): 961e891c 97eadfd8 /data/app-lib/com.mkdigitalsolutions.puzzler-1/libcocos2djs.so (cocos2d::Mat4::multiply(cocos2d::Mat4 const&)+44)
I/DEBUG ( 154): #02 961e8920 b7aa4898 [heap]
I/DEBUG ( 154): 961e8924 961e89f0 [stack:3067]
I/DEBUG ( 154): 961e8928 b7aa4898 [heap]
I/DEBUG ( 154): 961e892c 0453e10c
I/DEBUG ( 154): 961e8930 961ecf34
I/DEBUG ( 154): 961e8934 98c13934 /data/app-lib/com.mkdigitalsolutions.puzzler-1/libcocos2djs.so
I/DEBUG ( 154): 961e8938 961e8958 [stack:3067]
I/DEBUG ( 154): 961e893c 97ece55d /data/app-lib/com.mkdigitalsolutions.puzzler-1/libcocos2djs.so (cocos2d::Mat4::operator*=(cocos2d::Mat4 const&)+37)
My main.js code looks something like this:
cc.game.onStart = function(){
if(!cc.sys.isNative && document.getElementById("cocosLoading")) //If referenced loading.js, please remove it
document.body.removeChild(document.getElementById("cocosLoading"));
LibraryIntegration.iniAnalytics();
cc.view.adjustViewPort(true);
if (cc.sys.isNative)
{
var searchPaths = jsb.fileUtils.getSearchPaths();
// ipad retina
if (cc.view.getFrameSize().width >= 1536 && cc.view.getFrameSize().height >= 1536)
{
cc.log("large");
searchPaths.push("res/resolutions/large");
searchPaths.push("src");
}
else if (cc.view.getFrameSize().width >= 640 && cc.view.getFrameSize().height >= 640) //iphone hd or above and android high res screens
{
cc.log("Medium");
searchPaths.push("res/resolutions/medium");
searchPaths.push("src");
}
else
{
cc.log("small");
searchPaths.push("res/resolutions/small");
searchPaths.push("src");
}
jsb.fileUtils.setSearchPaths(searchPaths);
}
else
{
cc.view.resizeWithBrowserSize(true);
}
cc.view.setDesignResolutionSize(640, 960, cc.ResolutionPolicy.FIXED_WIDTH);
cc.eventManager.addCustomListener(cc.game.EVENT_HIDE, function(){
//onEnterBackground handler
cc.log("Did enter bg");
var difference = differenceBetweenDates(0);
recordTotalTimePlayed(difference.diff);
recordSessionTimePlayed(difference.diff);
});
cc.eventManager.addCustomListener(cc.game.EVENT_SHOW, function(){
//onEnterForeground handler
cc.log("Did enter fg");
recordTimeForSession();
});
recordTimeForSession();
cc.LoaderScene.preload(main_menu_resources, function () {
cc.director.runScene(new MainMenuScene());
}, this);
setStarsForLevels();
};
cc.game.run();
If i comment mainMenuScene loading lines - it runs fine with a black screen. My main scene code:
var MainMenuScene = cc.Scene.extend({
onEnter:function () {
this._super();
var mainMenuUI = ccs.load(mainMenuRes.MainMenuUI, "res/");
//mainMenuUI.node.ignoreAnchorPointForPosition(false);
mainMenuUI.node.setAnchorPoint(0.5, 0.5);
mainMenuUI.node.setPosition(cc.director.getVisibleOrigin().x + cc.director.getVisibleSize().width * 0.5, cc.director.getVisibleOrigin().y + cc.director.getVisibleSize().height * 0.5);
this.addChild(mainMenuUI.node);
var play = mainMenuUI.node.getChildByName("Play");
cc.assert(cc.sys.isObjectValid(play), "Play button not valid");
play.addTouchEventListener(function (sender, type) {
if(type != ccui.Widget.TOUCH_ENDED) return;
Redirect.goToEpochSelection();
}, this);
var stats = mainMenuUI.node.getChildByName("stats");
cc.assert(cc.sys.isObjectValid(stats), "Stats button not valid");
stats.addTouchEventListener(function (sender, type) {
if(type != ccui.Widget.TOUCH_ENDED) return;
Redirect.goToStats();
}, this);
var color = mainMenuUI.node.getChildByName("Color");
cc.assert(cc.sys.isObjectValid(color), "Color not valid");
color.setContentSize(5000, 5000);
}
});
Any help would be appreciated.
Cheers!
UPDATE:
So i think i found the reason but not the solution yet. I was building for 3 architectures for android - APP_ABI := armeabi-v7a armeabi x86, if i build only for armeabi - crash is gone but it just works on that architecture emulators or devices....
User contributions licensed under CC BY-SA 3.0