出现了标题所说的现象,已解决,错误 log 和解决方法如下。
03-19 19:58:54.366 244-244/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-19 19:58:54.366 244-244/? I/DEBUG: Build fingerprint: 'Android/cancro/cancro:4.4.4/V417IR/eng.root.20180112.155042:eng/test-keys'
03-19 19:58:54.366 244-244/? I/DEBUG: Revision: '0'
03-19 19:58:54.366 244-244/? I/DEBUG: pid: 13628, tid: 13628, name: arme.gamecenter >>> com.****.****.******.gamecenter <<<
03-19 19:58:54.366 244-244/? I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
03-19 19:58:54.522 244-244/? I/DEBUG: eax 00000000 ebx 79a23bb8 ecx 00000000 edx 00000000
03-19 19:58:54.522 244-244/? I/DEBUG: esi 79a6ea90 edi 00000000
03-19 19:58:54.522 244-244/? I/DEBUG: xcs 00000073 xds 0000007b xes 0000007b xfs 00000000 xss 0000007b
03-19 19:58:54.522 244-244/? I/DEBUG: eip 40089246 ebp bfd15c08 esp bfd15b7c flags 00210246
03-19 19:58:54.522 244-244/? I/DEBUG: backtrace:
03-19 19:58:54.522 244-244/? I/DEBUG: #00 pc 00041246 /system/lib/libc.so (strlen+6)
03-19 19:58:54.522 244-244/? I/DEBUG: #01 pc 005c7f92 /data/app-lib/com.xxhy.xyyx.nearme.gamecenter-1/libunity.so (UnitySendMessage+34)
03-19 19:58:54.522 244-244/? I/DEBUG: #02 pc 005d91b7 /data/app-lib/com.xxhy.xyyx.nearme.gamecenter-1/libunity.so
03-19 19:58:54.522 244-244/? I/DEBUG: #03 pc 0002a33b /system/lib/libdvm.so (dvmPlatformInvoke+79)
03-19 19:58:54.522 244-244/? I/DEBUG: #04 pc 00006dbf [heap]
03-19 19:58:54.522 244-244/? I/DEBUG: #05 pc 00086c32 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+434)
03-19 19:58:54.522 244-244/? I/DEBUG: #06 pc 00177918 /system/lib/libdvm.so
03-19 19:58:54.522 244-244/? I/DEBUG: #07 pc 00005dc7
03-19 19:58:54.522 244-244/? I/DEBUG: #08 pc 0003b7f2 /system/lib/libdvm.so (dvmMterpStd(Thread*)+66)
03-19 19:58:54.522 244-244/? I/DEBUG: #09 pc 00036eb9 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+217)
03-19 19:58:54.522 244-244/? I/DEBUG: #10 pc 000bc0f6 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+1750)
03-19 19:58:54.522 244-244/? I/DEBUG: #11 pc 000d1a50 /system/lib/libdvm.so (Dalvik_java_lang_reflect_Method_invokeNative(unsigned int const*, JValue*)+288)
03-19 19:58:54.522 244-244/? I/DEBUG: #12 pc 00177918 /system/lib/libdvm.so
03-19 19:58:54.522 244-244/? I/DEBUG: #13 pc 00005eff
03-19 19:58:54.522 244-244/? I/DEBUG: #14 pc 0003b7f2 /system/lib/libdvm.so (dvmMterpStd(Thread*)+66)
03-19 19:58:54.522 244-244/? I/DEBUG: #15 pc 00036eb9 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+217)
03-19 19:58:54.522 244-244/? I/DEBUG: #16 pc 000bcf57 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, char*)+759)
03-19 19:58:54.522 244-244/? I/DEBUG: #17 pc 0007862d /system/lib/libdvm.so (CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, char*)+109)
03-19 19:58:54.526 244-244/? I/DEBUG: #18 pc 0005f6ba /system/lib/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+42)
03-19 19:58:54.526 244-244/? I/DEBUG: #19 pc 00060e54 /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+884)
03-19 19:58:54.526 244-244/? I/DEBUG: #20 pc 00001017 /system/bin/app_process (main+567)
03-19 19:58:54.526 244-244/? I/DEBUG: #21 pc 0000d60c /system/lib/libc.so (__libc_init+108)
03-19 19:58:54.526 244-244/? I/DEBUG: #22 pc 00000a91 /system/bin/app_process (_start+97)
03-19 19:58:54.526 244-244/? I/DEBUG: stack:
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b3c 40055fe9 /system/lib/libc.so (pthread_mutex_unlock+25)
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b40 46505845 /dev/ashmem/dalvik-heap (deleted)
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b44 42801c80
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b48 430dd2c0 /dev/ashmem/dalvik-heap (deleted)
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b4c 400e3fcc /system/lib/libc.so
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b50 430dd334 /dev/ashmem/dalvik-heap (deleted)
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b54 430dd37a /dev/ashmem/dalvik-heap (deleted)
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b58 00000072
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b5c 4005528f /system/lib/libc.so (malloc+31)
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b60 00000024
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b64 00000000
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b68 00000052
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b6c 4265ead9 /system/lib/libdvm.so (dvmChangeStatus(Thread*, ThreadStatus)+25)
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b70 0000000f
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b74 40055276 /system/lib/libc.so (malloc+6)
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b78 4278dcbc /system/lib/libdvm.so
03-19 19:58:54.526 244-244/? I/DEBUG: #00 bfd15b7c 78c8ef93 /data/app-lib/com.xxhy.xyyx.nearme.gamecenter-1/libunity.so (UnitySendMessage+35)
03-19 19:58:54.526 244-244/? I/DEBUG: #01 bfd15b80 00000000
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b84 08c00021
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b88 08c00021
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b8c 426425b9 /system/lib/libdvm.so (dvmDecodeIndirectRef(Thread*, _jobject*)+233)
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b90 80c735a8 [heap]
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b94 08c00021
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b98 00736033
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15b9c 8ddfac20 [anon:libc_malloc]
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15ba0 430dd308 /dev/ashmem/dalvik-heap (deleted)
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15ba4 00000000
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15ba8 42663f99 /system/lib/libdvm.so (dvmCreateCstrFromString(StringObject const*)+9)
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15bac 4278dcbc /system/lib/libdvm.so
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15bb0 80c73500 [heap]
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15bb4 00000000
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15bb8 00000000
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15bbc 42645a20 /system/lib/libdvm.so (GetStringUTFChars(_JNIEnv*, _jstring*, unsigned char*)+128)
03-19 19:58:54.526 244-244/? I/DEBUG: ........ ........
03-19 19:58:54.526 244-244/? I/DEBUG: #02 bfd15c10 8ddfac00 [anon:libc_malloc]
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c14 8ddfac20 [anon:libc_malloc]
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c18 00000000
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c1c 40055fe9 /system/lib/libc.so (pthread_mutex_unlock+25)
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c20 00000000
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c24 8ddfac20 [anon:libc_malloc]
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c28 8ddfac00 [anon:libc_malloc]
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c2c 4278dcbc /system/lib/libdvm.so
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c30 00000000
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c34 430dd328 /dev/ashmem/dalvik-heap (deleted)
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c38 782f8000 /dev/ashmem/dalvik-aux-structure (deleted)
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c3c 6e98bdd8
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c40 bfd15c68 [stack]
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c44 00000004
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c48 bfd15c88 [stack]
03-19 19:58:54.526 244-244/? I/DEBUG: bfd15c4c 425f133c /system/lib/libdvm.so (dvmPlatformInvoke+80)
--------- beginning of /dev/log/system
03-19 19:58:54.610 536-557/? I/BootReceiver: Copying /data/tombstones/tombstone_09 to DropBox (SYSTEM_TOMBSTONE)
填坑了!!! 可能是没有在主线程调用 GameCenterSDK.getInstance().doReportUserGameInfoData() // 20180319
再次填坑!!!正确的调用代码如下
public static void OPPOReportUserGameInfoData()
{
UnityPlayer.currentActivity.runOnUiThread(new Runnable()
{
public void run()
{
GameCenterSDK.getInstance().doReportUserGameInfoData(//UnityPlayer.currentActivity,
new ReportUserGameInfoParam(ms_app_id, ms_server_name, ms_role_name, ms_role_level),
new ApiCallback() {
@Override
public void onSuccess(String resultMsg) {
UnityPlayer.UnitySendMessage("TestCallback", "OnOPPOReportUserGameInfoDataSuccess", "" + resultMsg);
}
@Override
public void onFailure(String resultMsg, int resultCode) {
UnityPlayer.UnitySendMessage("TestCallback", "OnOPPOReportUserGameInfoDataFailure", "" + resultMsg + "," + resultCode);
}
});
}
});
}
之前 Unity 崩溃的原因是 onSuccess(String resultMsg) 的 resultMsg 有可能传回 null, 之前呼叫 Unity 直接写成了 UnityPlayer.UnitySendMessage("TestCallback", "OnOPPOReportUserGameInfoDataSuccess", resultMsg) 所以当 resultMsg 为 null 的时候 Unity 崩了。20180320