creator1.5.1版本
以下是部分用户闪退日志
08-24 11:25:28.084 5555 5734 D cocos2d-x debug info: AudioMgr--------->gameHideEvent---->openwechat = false
08-24 11:25:28.084 5555 5844 V AudioMixerController: Doesn’t have enough tracks: 1, 1
08-24 11:25:28.084 5555 5734 D cocos2d-x debug info: AudioMgr--------->stopAll
08-24 11:25:28.084 5555 5734 V PcmAudioPlayer: PcmAudioPlayer (0xc9b45690) stop …
08-24 11:25:28.084 5555 5734 V : Removing player id=102, state:4
08-24 11:25:28.084 5555 5734 V UrlAudioPlayer: UrlAudioPlayer::stop (0xc4204300, 97)
08-24 11:25:28.084 5555 5734 V : Removing player id=97, state:4
08-24 11:25:28.084 5555 5734 V UrlAudioPlayer: UrlAudioPlayer::destroy() 0xc4204300
08-24 11:25:28.214 5555 5734 V UrlAudioPlayer: UrlAudioPlayer::destroy end
08-24 11:25:28.214 5555 5734 V UrlAudioPlayer: ~UrlAudioPlayer(): 0xc4204300
08-24 11:25:28.214 5555 5734 V AssetFd : ~AssetFd: 51
08-24 11:25:28.366 5555 5555 I AppActivity: onStop---------------
08-24 11:25:28.366 5555 5555 I awcn.ComponentCallbacks2: onTrimMemory level:20
08-24 11:25:28.366 5555 5555 I awcn.SessionCenter: |[seq:[default]] [background]
08-24 11:25:28.367 5555 5555 I awcn.StrategyCenter: saveData
08-24 11:25:28.367 5555 5555 I awcn.SessionCenter: |[seq:23797641] [background]
08-24 11:25:28.367 5555 5555 I awcn.StrategyCenter: saveData
08-24 11:25:28.455 5555 5555 W IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
08-24 11:25:28.455 5555 5555 W IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
08-24 11:25:28.870 5555 5555 V MicroMsg.SDK.WXApiImplV10.ActivityLifecycleCb: WXStat trigger onBackground
08-24 11:25:28.925 5555 11730 D WebSocket.cpp: Receiving data:index:215, len=59
08-24 11:25:35.989 5555 11730 D WebSocket.cpp: Receiving data:index:216, len=72
08-24 11:25:36.477 5555 5555 I AppActivity: onRestart---------------
08-24 11:25:36.491 5555 5555 I AppActivity: onStart---------------
08-24 11:25:36.491 5555 5555 D Cocos2dxActivity: onResume()
08-24 11:25:36.491 5555 5555 V MicroMsg.SDK.WXApiImplV10.ActivityLifecycleCb: org.cocos2dx.javascript.AppActivity onActivityResumed
08-24 11:25:36.491 5555 5555 I awcn.SessionCenter: |[seq:[default]] [forground]
08-24 11:25:36.491 5555 5555 I awcn.SessionCenter: |[seq:23797641] [forground]
08-24 11:25:36.492 5555 5746 D awcn.StrategyCenter: getSchemeByHost host:acs4public.m.taobao.com scheme:https
08-24 11:25:36.492 5555 5746 D awcn.SessionCenter: |[seq:23797641] getInternal u:https://acs4public.m.taobao.com TypeClass:SPDY timeout:0
08-24 11:25:36.492 5555 5746 D awcn.StrategyCenter: getSchemeByHost host:acs4public.m.taobao.com scheme:https
08-24 11:25:36.492 5555 5746 D awcn.SessionCenter: |[seq:23797641] get internal hit cache session session:Session@[23797641.AWCN3_1|http2_0rtt_acs]
08-24 11:25:36.495 5555 5555 D AudioFocusManager: requestAudioFocus succeed
08-24 11:25:36.495 5555 5555 I AppActivity: onResume---------------
08-24 11:25:36.516 5555 11945 D AppTracker: App Event: start
08-24 11:25:36.571 5555 5555 D Cocos2dxActivity: onWindowFocusChanged() hasFocus=true
08-24 11:25:36.572 5555 5734 D cocos2d-x debug info: AudioMgr--------->gameShowEvent---->openwechat = false
08-24 11:25:36.572 5555 5734 D cocos2d-x debug info: resumeBGM----->audioUrl = res/raw-assets/resources/sounds/bgFight2.mp3,bgmVolume = 1
08-24 11:25:36.572 5555 5734 V : play2d, _audioPlayers.size=0
08-24 11:25:36.572 5555 5734 V AudioPlayerProvider: (assets/res/raw-assets/resources/sounds/bgFight2.mp3) file size: 1044289
08-24 11:25:36.572 5555 5734 V UrlAudioPlayer: Current UrlAudioPlayer instance count: 1
08-24 11:25:36.572 5555 5734 V UrlAudioPlayer: UrlAudioPlayer::prepare: assets/res/raw-assets/resources/sounds/bgFight2.mp3, SL_DATALOCATOR_ANDROIDFD, 51, 4595836, 1044289
08-24 11:25:36.573 5555 5734 D cocos2d-x debug info: setFinishCallback----->bgmAudioID = 103
08-24 11:25:36.853 5555 5734 W google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
08-24 11:25:36.853 5555 5734 W google-breakpad: Chrome build fingerprint:
08-24 11:25:36.853 5555 5734 W google-breakpad: 1.4.4
08-24 11:25:36.853 5555 5734 W google-breakpad: 144
08-24 11:25:36.853 5555 5734 W google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
08-24 11:25:36.855 5555 5734 D bugrpt : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x00000000
08-24 11:25:37.061 5555 5737 I awcn.TnetSpdySession: |[seq:23797641.AWCN3_1] ping receive Host:https://acs4public.m.taobao.com id:10
08-24 23:45:57.497 10472 10545 D cocos2d-x debug info: AudioMgr--------->gameHideEvent---->openwechat = false
08-24 23:45:57.497 10472 10545 D cocos2d-x debug info: AudioMgr--------->stopAll
08-24 23:45:57.497 10472 10545 V PcmAudioPlayer: PcmAudioPlayer (0xb22fdf60) stop …
08-24 23:45:57.497 10472 10545 V : Removing player id=3721, state:4
08-24 23:45:57.497 10472 10545 V PcmAudioPlayer: PcmAudioPlayer (0xb09cb2d0) stop …
08-24 23:45:57.497 10472 10545 V : Removing player id=3720, state:4
08-24 23:45:57.497 10472 10545 V UrlAudioPlayer: UrlAudioPlayer::stop (0xad643480, 3687)
08-24 23:45:57.497 10472 10545 V : Removing player id=3687, state:4
08-24 23:45:57.497 10472 10545 V UrlAudioPlayer: UrlAudioPlayer::destroy() 0xad643480
08-24 23:45:57.522 10472 10472 I AppActivity: onStop---------------
08-24 23:45:57.565 10472 10545 V UrlAudioPlayer: UrlAudioPlayer::destroy end
08-24 23:45:57.565 10472 10545 V UrlAudioPlayer: ~UrlAudioPlayer(): 0xad643480
08-24 23:45:57.565 10472 10545 V AssetFd : ~AssetFd: 71
08-24 23:45:58.278 10472 10472 V MicroMsg.SDK.WXApiImplV10.ActivityLifecycleCb: WXStat trigger onBackground
08-24 23:45:58.541 10472 20190 D WebSocket.cpp: Receiving data:index:4925, len=34
08-24 23:45:58.541 10472 20190 D WebSocket.cpp: Receiving data:index:4926, len=35
08-24 23:45:59.219 10472 10472 V InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@bd20b56 nm : com.huidutek.sjmj ic=null
08-24 23:45:59.219 10472 10472 I InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
08-24 23:45:59.220 10472 10472 D InputTransport: Input channel constructed: fd=85
08-24 23:45:59.220 10472 10472 D InputTransport: Input channel destroyed: fd=87
08-24 23:45:59.225 10472 10472 I AppActivity: onRestart---------------
08-24 23:45:59.244 10472 10472 I AppActivity: onStart---------------
08-24 23:45:59.248 10472 10472 D Cocos2dxActivity: onResume()
08-24 23:45:59.248 10472 10472 V MicroMsg.SDK.WXApiImplV10.ActivityLifecycleCb: org.cocos2dx.javascript.AppActivity onActivityResumed
08-24 23:45:59.250 10472 10472 D AudioManager: requestAudioFocus status : 1
08-24 23:45:59.250 10472 10472 D AudioFocusManager: requestAudioFocus succeed
08-24 23:45:59.251 10472 10472 I AppActivity: onResume---------------
08-24 23:45:59.251 10472 10545 D cocos2d-x debug info: AudioMgr--------->gameShowEvent---->openwechat = false
08-24 23:45:59.251 10472 10545 D cocos2d-x debug info: resumeBGM----->audioUrl = res/raw-assets/resources/sounds/bgFight.mp3,bgmVolume = 1
08-24 23:45:59.251 10472 10545 V : play2d, _audioPlayers.size=0
08-24 23:45:59.252 10472 10545 V AudioPlayerProvider: (assets/res/raw-assets/resources/sounds/bgFight.mp3) file size: 998966
08-24 23:45:59.252 10472 10545 V UrlAudioPlayer: Current UrlAudioPlayer instance count: 1
08-24 23:45:59.252 10472 10545 V UrlAudioPlayer: UrlAudioPlayer::prepare: assets/res/raw-assets/resources/sounds/bgFight.mp3, SL_DATALOCATOR_ANDROIDFD, 71, 3596788, 998966
08-24 23:45:59.253 10472 10545 D cocos2d-x debug info: setFinishCallback----->bgmAudioID = 3722
08-24 23:45:59.266 10472 10472 W Activity: AppLock checkAppLockState locked:false verifying:false pkgName = com.huidutek.sjmj isInMultiWindowMode:false
08-24 23:45:59.307 10472 10472 D SurfaceView: Relayout returned: oldFrame=[0,0][2008,1080] newFrame=[0,0][2008,1080] result=0x1 surface={Surface(name=null)/@0x6d3c8a1 isValid=true -1162891264}
08-24 23:45:59.594 10472 10545 W google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
08-24 23:45:59.594 10472 10545 W google-breakpad: Chrome build fingerprint:
08-24 23:45:59.594 10472 10545 W google-breakpad: 1.4.4
08-24 23:45:59.594 10472 10545 W google-breakpad: 144
08-24 23:45:59.594 10472 10545 W google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
08-24 23:45:59.595 10472 10545 D bugrpt : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x00000000
感觉是返回后播放背景音乐导致的,但是不是必现,部分机型会有这个问题
以下是切到后台和切回游戏的代码
cc.game.on(cc.game.EVENT_HIDE, function() {
cc.vv.audioMgr.gameHideEvent();
});
cc.game.on(cc.game.EVENT_SHOW, function() {
cc.vv.audioMgr.gameShowEvent();
});
gameShowEvent: function() {
if (this.background) {
cc.vv.gameLog.log("AudioMgr--------->gameShowEvent---->openwechat = " + cc.vv.anysdkMgr._openWechat);
this.background = false;
this.gameShowTime = Date.now();
if (cc.vv.anysdkMgr._openWechat) {
cc.vv.anysdkMgr._openWechat = false;
return;
}
if (this.gameHideTime && this.gameShowTime) {
if (this.gameShowTime - this.gameHideTime > 60000 * 30) {
cc.vv.gameLog.log("AudioMgr--------->gameShowEvent->restart");
this.stopAll();
cc.game.restart();
return;
}
}
this.resumeBGM();
cc.vv.userMgr.dispatchHallEvent('game_event_show', 0);
}
},
gameHideEvent: function() {
if (!this.background) {
cc.vv.gameLog.log("AudioMgr--------->gameHideEvent---->openwechat = " + cc.vv.anysdkMgr._openWechat);
this.background = true;
this.gameHideTime = Date.now();
if (cc.vv.anysdkMgr._openWechat) {
return;
}
this.stopAll();
}
},
resumeBGM: function() {
cc.vv.gameLog.log("resumeBGM----->audioUrl = " + this.bgmAudioURL + ",bgmVolume = " + this.bgmVolume);
if (this.bgmVolume > 0) {
this.bgmAudioID = cc.audioEngine.play(this.bgmAudioURL, true, this.bgmVolume);
if (cc.sys.isNative) {
cc.vv.gameLog.log("setFinishCallback----->bgmAudioID = " + this.bgmAudioID);
cc.audioEngine.setFinishCallback(this.bgmAudioID, this.bgmFinishCallback);
}
}
},