Cocos Creator v2.1.0 版本 游戏集成到Android,首次运行游戏正常,退出重新运行崩溃

  • Creator 版本:Cocos Creator v2.1.0 版本

  • 目标平台: Android

  • 详细报错信息,包含调用堆栈:09-29 18:13:38.234 29139-29909/com.zy.course.dev E/memtrack_graphic: graphic_memtrack_get_memory error to open /sys/kernel/debug/ion/clients/29139: Permission denied
    09-29 18:13:38.309 29139-29909/com.zy.course.dev E/CrashReport: #++++++++++Record By Bugly++++++++++#
    09-29 18:13:38.309 29139-29909/com.zy.course.dev E/CrashReport: # You can use Bugly(http:\bugly.qq.com) to get more Crash Detail!
    09-29 18:13:38.309 29139-29909/com.zy.course.dev E/CrashReport: # PKG NAME: com.zy.course.dev
    09-29 18:13:38.309 29139-29909/com.zy.course.dev E/CrashReport: # APP VER: 1.3.1
    09-29 18:13:38.310 29139-29909/com.zy.course.dev E/CrashReport: # LAUNCH TIME: 2019-09-29 18:12:38
    09-29 18:13:38.310 29139-29909/com.zy.course.dev E/CrashReport: # CRASH TYPE: NATIVE_CRASH
    09-29 18:13:38.310 29139-29909/com.zy.course.dev E/CrashReport: # CRASH TIME: 2019-09-29 18:13:38
    09-29 18:13:38.310 29139-29909/com.zy.course.dev E/CrashReport: # CRASH PROCESS: com.zy.course.dev
    09-29 18:13:38.310 29139-29909/com.zy.course.dev E/CrashReport: # CRASH THREAD: Thread-12948
    09-29 18:13:38.310 29139-29909/com.zy.course.dev E/CrashReport: # REPORT ID: ab875783-7131-4e03-b3bb-a19b9955adae
    09-29 18:13:38.310 29139-29909/com.zy.course.dev E/CrashReport: # CRASH DEVICE: Le X620 UNROOT
    09-29 18:13:38.311 29139-29909/com.zy.course.dev E/CrashReport: # RUNTIME AVAIL RAM:1056088064 ROM:16107569152 SD:16107569152
    09-29 18:13:38.311 29139-29909/com.zy.course.dev E/CrashReport: # RUNTIME TOTAL RAM:2931671040 ROM:25648013312 SD:25648013312
    09-29 18:13:38.311 29139-29909/com.zy.course.dev E/CrashReport: # EXCEPTION FIRED BY KERNEL UNKNOWN
    09-29 18:13:38.311 29139-29909/com.zy.course.dev E/CrashReport: # CRASH STACK:
    09-29 18:13:38.311 29139-29909/com.zy.course.dev E/CrashReport: SIGILL(ILL_ILLOPC)
    0xb061cada
    #00 pc 002edada /data/app/com.zy.course.dev-1/lib/arm/libcocos2djs.so [armeabi-v7a::8cedb1e74a76428452d38069b073890a]
    #01 pc 001018c8
    java:
    org.cocos2dx.lib.Cocos2dxRenderer.onSurfaceCreated(Cocos2dxRenderer.java:66)
    android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1549)
    android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1286)
    09-29 18:13:38.311 29139-29909/com.zy.course.dev E/CrashReport: #++++++++++++++++++++++++++++++++++++++++++#
    09-29 18:13:38.599 1146-1146/? E/MPlugin: Unsupported class: com.mediatek.common.ctm.ICtmExt
    09-29 18:13:38.599 1146-1146/? E/getCtmName: Failed to get CTM plugin
    09-29 18:13:38.614 1146-1146/? E/NotificationService: xulei call cancelNotification isShadowProc: false, callingPid:1629, pkg:com.android.systemui,get index:-1
    09-29 18:13:38.637 29139-29894/com.zy.course.dev A/libc: Fatal signal 4 (SIGILL), code 1, fault addr 0xb061cada in tid 29894 (GLThread 12944)
    09-29 18:13:38.730 1146-1146/? E/WifiTrafficPoller: TRAFFIC_STATS_POLL true Token 3694 num clients 22
    09-29 18:13:38.730 1146-1146/? E/WifiTrafficPoller: packet count Tx=3557543 Rx=4195128
    09-29 18:13:38.730 1146-1146/? E/WifiTrafficPoller: notifying of data activity 3
    09-29 18:13:38.735 1146-1146/? E/NotificationService: Suppressing notification from package com.letv.android.supermanager by user request.
    09-29 18:13:38.741 21547-21564/? E/ScreenOnOffReceiver: Scroll Play HotWord thread run
    09-29 18:13:38.742 29929-29929/? A/AEE/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    09-29 18:13:38.742 29929-29929/? A/AEE/DEBUG: Build fingerprint: ‘LeEco/Le2_CN1/le_x6:6.0/HEXCNFN6003009092S/1536441333:user/release-keys’
    09-29 18:13:38.742 29929-29929/? A/AEE/DEBUG: Revision: ‘0’
    09-29 18:13:38.742 29929-29929/? A/AEE/DEBUG: ABI: ‘arm’
    09-29 18:13:38.743 29929-29929/? A/AEE/DEBUG: pid: 29139, tid: 29894, name: GLThread 12944 >>> com.zy.course.dev <<<
    09-29 18:13:38.743 29929-29929/? A/AEE/DEBUG: signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0xb061cada
    09-29 18:13:38.889 1146-1286/? E/WifiStateMachine: ConnectedState (when=-2ms what=131155 arg1=2062!CMD_RSSI_POLL rt=1618291890/2340225890 2062 0 “MIT-5G” 38:17:c3:c5:97:11 rssi=-54 f=5745 sc=60 link=433 tx=14.8, 0.0, 0.0 rx=12.1 bcn=0 [on:0 tx:0 rx:0 period:2967] from screen [on:0 period:2088955849] gl hn rssi=-49 ag=0 hr ticks 0,0,37 ls-=0 [56,56,60,60,65] brc=0 lrc=0 offload-stoppedmmls=
    Failed=548040900608 Retry=2 MultipleRetry=6869191503434106198 ACKFailure=9232388032202539008 FCSError=0 tx_ok=0 rx_ok=0
    09-29 18:13:38.890 1146-1286/? E/WifiStateMachine: L2ConnectedState (when=-3ms what=131155 arg1=2062!CMD_RSSI_POLL rt=1618291891/2340225891 2062 0 “MIT-5G” 38:17:c3:c5:97:11 rssi=-54 f=5745 sc=60 link=433 tx=14.8, 0.0, 0.0 rx=12.1 bcn=0 [on:0 tx:0 rx:0 period:1] from screen [on:0 period:2088955850] gl hn rssi=-49 ag=0 hr ticks 0,0,37 ls-=0 [56,56,60,60,65] brc=0 lrc=0 offload-stoppedmmls=
    Failed=548040900608 Retry=2 MultipleRetry=6869191503434106198 ACKFailure=9232388032202539008 FCSError=0 tx_ok=0 rx_ok=0
    09-29 18:13:38.898 1146-1286/? E/WifiStateMachine: wifiLinkStatics=
    Failed=548040900608 Retry=2 MultipleRetry=6869191503434106198 ACKFailure=9232388032202539008 FCSError=0 tx_ok=0 rx_ok=0
    09-29 18:13:38.899 1146-1286/? E/WifiConfigStore: updateConfiguration freq=5745 BSSID=38:17:c3:c5:97:11 RSSI=-53 "MIT-5G"WPA_PSK
    09-29 18:13:39.051 29929-29929/? A/AEE/DEBUG: r0 00000001 r1 00000000 r2 00004001 r3 00000004
    09-29 18:13:39.051 29929-29929/? A/AEE/DEBUG: r4 b11600ed r5 00000938 r6 b11e16a2 r7 f727d434
    09-29 18:13:39.051 29929-29929/? A/AEE/DEBUG: r8 c1dec2c0 r9 b2143600 sl cce24ec0 fp cce24bc0
    09-29 18:13:39.051 29929-29929/? A/AEE/DEBUG: ip 000074c6 sp cce248b0 lr b061b313 pc b061cada cpsr 40030030
    09-29 18:13:39.053 29929-29929/? A/AEE/DEBUG: backtrace:
    09-29 18:13:39.053 29929-29929/? A/AEE/DEBUG: #00 pc 002edada /data/app/com.zy.course.dev-1/lib/arm/libcocos2djs.so
    09-29 18:13:39.053 29929-29929/? A/AEE/DEBUG: #01 pc 001018c8 [stack:29894]
    09-29 18:13:39.733 1146-1146/? E/WifiTrafficPoller: TRAFFIC_STATS_POLL true Token 3694 num clients 22
    09-29 18:13:39.733 1146-1146/? E/WifiTrafficPoller: packet count Tx=3557545 Rx=4195128
    09-29 18:13:39.733 1146-1146/? E/WifiTrafficPoller: notifying of data activity 2
    09-29 18:13:40.705 1146-1146/? E/NotificationService: Suppressing notification from package com.letv.android.supermanager by user request.
    09-29 18:13:40.734 1146-1146/? E/WifiTrafficPoller: TRAFFIC_STATS_POLL true Token 3694 num clients 22
    09-29 18:13:40.735 1146-1146/? E/WifiTrafficPoller: packet count Tx=3557547 Rx=4195129
    09-29 18:13:40.735 1146-1146/? E/WifiTrafficPoller: notifying of data activity 3
    09-29 18:13:41.049 1146-1576/? E/NativeCrashListener: Exception dealing with report
    android.system.ErrnoException: read failed: EAGAIN (Try again)
    at libcore.io.Posix.readBytes(Native Method)
    at libcore.io.Posix.read(Posix.java:169)
    at libcore.io.BlockGuardOs.read(BlockGuardOs.java:230)
    at android.system.Os.read(Os.java:367)
    at com.android.server.am.NativeCrashListener.consumeNativeCrashData(NativeCrashListener.java:240)
    at com.android.server.am.NativeCrashListener.run(NativeCrashListener.java:138)
    09-29 18:13:41.737 1146-1146/? E/WifiTrafficPoller: TRAFFIC_STATS_POLL true Token 3694 num clients 22
    09-29 18:13:41.738 1146-1146/? E/WifiTrafficPoller: packet count Tx=3557547 Rx=4195129
    09-29 18:13:41.738 1146-1146/? E/WifiTrafficPoller: notifying of data activity 0
    09-29 18:13:41.903 1146-1286/? E/WifiStateMachine: ConnectedState (when=-4ms what=131155 arg1=2062!CMD_RSSI_POLL rt=1618294904/2340228904 2062 0 “MIT-5G” 38:17:c3:c5:97:11 rssi=-53 f=5745 sc=60 link=433 tx=21.9, 0.0, 0.0 rx=17.0 bcn=0 [on:0 tx:0 rx:0 period:2979] from screen [on:0 period:2088958863] gl hn rssi=-48 ag=0 hr ticks 0,0,37 ls-=0 [56,56,60,60,65] brc=0 lrc=0 offload-stoppedmmls=
    Failed=548040900608 Retry=2 MultipleRetry=6869191503434106198 ACKFailure=9232388032202539008 FCSError=0 tx_ok=0 rx_ok=0
    09-29 18:13:41.905 1146-1286/? E/WifiStateMachine: L2ConnectedState (when=-5ms what=131155 arg1=2062!CMD_RSSI_POLL rt=1618294905/2340228906 2062 0 “MIT-5G” 38:17:c3:c5:97:11 rssi=-53 f=5745 sc=60 link=433 tx=21.9, 0.0, 0.0 rx=17.0 bcn=0 [on:0 tx:0 rx:0 period:2] from screen [on:0 period:2088958865] gl hn rssi=-48 ag=0 hr ticks 0,0,37 ls-=0 [56,56,60,60,65] brc=0 lrc=0 offload-stoppedmmls=
    Failed=548040900608 Retry=2 MultipleRetry=6869191503434106198 ACKFailure=9232388032202539008 FCSError=0 tx_ok=0 rx_ok=0
    09-29 18:13:41.910 1146-1286/? E/WifiStateMachine: wifiLinkStatics=
    Failed=548040900608 Retry=2 MultipleRetry=6869191503434106198 ACKFailure=9232388032202539008 FCSError=0 tx_ok=0 rx_ok=0
    09-29 18:13:41.911 1146-1286/? E/WifiConfigStore: updateConfiguration freq=5745 BSSID=38:17:c3:c5:97:11 RSSI=-53 "MIT-5G"WPA_PSK
    09-29 18:13:42.725 1146-1146/? E/NotificationService: Suppressing notification from package com.letv.android.supermanager by user request.
    09-29 18:13:42.739 1146-1146/? E/WifiTrafficPoller: TRAFFIC_STATS_POLL true Token 3694 num clients 22
    09-29 18:13:42.740 1146-1146/? E/WifiTrafficPoller: packet count Tx=3557548 Rx=4195129
    09-29 18:13:42.740 1146-1146/? E/WifiTrafficPoller: notifying of data activity 2
    09-29 18:13:43.356 29929-29929/? E/AEE/AED: request.action: 0
    09-29 18:13:43.608 1146-1289/? E/ConnectivityService: RemoteException caught trying to send a callback msg for NetworkRequest [ id=2496,

  • 重现方式:先运行一遍游戏,然后退出游戏时释放资源:

g_isGameFinished= true;
if (g_isGameFinished)
{
// with Application destructor called, native resource will be released
delete g_app;
g_app = nullptr;
g_isGameFinished= false;
}

auto scheduler = Application::getInstance()->getScheduler();
scheduler->removeAllFunctionsToBePerformedInCocosThread();
scheduler->unscheduleAll();

se::ScriptEngine::getInstance()->cleanup();
se::ScriptEngine::destroyInstance();
cocos2d::PoolManager::getInstance()->getCurrentPool()->clear();
FileUtils::getInstance()->destroyInstance();

//REFINE: Wait HttpClient, WebSocket, Audio thread to exit
EventDispatcher::destroy();

// g_isGameFinished = true;
g_isStarted = false;

  • 之前哪个版本是正常的 :

  • 手机型号 :

  • 手机浏览器 :

  • 编辑器操作系统 :

  • 编辑器之前是否有其它报错 :

  • 出现概率:

  • 额外线索:

经过调试,发现在初始化引擎的时候

这一句代码运行之后崩溃

@jera

@jera

遇到了同样的问题 有解决方案了吗

没有困扰了好久,直接用多进程做吧,把游戏都放在另一个进程里面运行,游戏结束完就kill掉