在调用Firebase.FirebaseApp.CheckAndFixDependenciesAsync()之后,FirebaseAuth.CurrentUser崩溃。我发现的方式如下:
if (FindObjectOfType <HammurabiFirebaseAuthentication>() && FindObjectOfType<HammurabiFirebaseAuthentication>().GetUserInfo() != null) {
Debug.Log("Remote 1 - " + FindObjectOfType<HammurabiFirebaseAuthentication>().GetUserInfo().UserId);
}
Debug.Log ("Firebase: Start Firebase initialization.");
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
Debug.Log("Dependency Status : " + task.Result);
if (FindObjectOfType<HammurabiFirebaseAuthentication>() && FindObjectOfType<HammurabiFirebaseAuthentication>().GetUserInfo() != null) {
Debug.Log("Remote 2 - " + FindObjectOfType<HammurabiFirebaseAuthentication>().GetUserInfo().UserId);
}
调试日志流是这样的:'Remote 1-....'->'Firebase:Start Firebase ...'-> CRASH!。我看不到秒远程日志“ Remote 2-...”。
如果您想知道我如何获得firebaseuser。 HammurabiFirebaseAuthentication在进行身份验证时在内部保留一个FirebaseAuth,方法实现如下:
public FirebaseUser GetUserInfo() {
if (HasUserInfo()) {
return auth.CurrentUser;
} else {
Debug.LogError("HammurabiFirebaseAuthentication - Not signed in, unable to get info.");
return null;
}
}
public bool HasUserInfo() {
return auth != null && auth.CurrentUser != null;
}
字段auth是FirebaseAuth。 这是我想从FirebaseAuth获取当前用户时收到的崩溃消息:
07-09 12:09:51.889 2792 2816 I Unity : Remote: Register for the event campaign
07-09 12:09:51.889 2792 2816 I Unity :
07-09 12:09:51.889 2792 2816 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
07-09 12:09:51.889 2792 2816 I Unity :
07-09 12:09:51.968 2792 2816 I Unity : Remote: Register for the event special
07-09 12:09:51.968 2792 2816 I Unity :
07-09 12:09:51.968 2792 2816 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
07-09 12:09:51.968 2792 2816 I Unity :
07-09 12:09:51.994 2792 3184 I GameAnalytics: Info/GameAnalytics: Add DESIGN event: {eventId:Map_Load:Main:MapMap01, value:1.0}
07-09 12:09:52.007 2792 3184 W GameAnalytics: Warning/GameAnalytics: SDK already initialized. Can only be called once.
07-09 12:09:52.010 983 4537 I libPerfService: perfGetLastBoostPid 2792
07-09 12:09:52.011 983 4537 I libPerfService: perfGetLastBoostPid 2792
07-09 12:09:52.054 2792 2845 E mono :
07-09 12:09:52.054 2792 2845 E mono : Unhandled Exception: System.IO.DirectoryNotFoundException: Directory '/tmp/7a9817a6' not found.
07-09 12:09:52.054 2792 2845 E mono : at System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mas
k, FileAttributes attrs) [0x00000] in <filename unknown>:0
07-09 12:09:52.054 2792 2845 E mono : at System.IO.Directory.GetDirectories (System.String path, System.String searchPattern) [0x00000] in <filename u
nknown>:0
07-09 12:09:52.054 2792 2845 E mono : at System.IO.Directory.GetDirectories (System.String path) [0x00000] in <filename unknown>:0
07-09 12:09:52.054 2792 2845 E mono : at System.IO.Directory.RecursiveDelete (System.String path) [0x00000] in <filename unknown>:0
07-09 12:09:52.054 2792 2845 E mono : at System.IO.Directory.Delete (System.String path, Boolean recursive) [0x00000] in <filename unknown>:0
07-09 12:09:52.054 2792 2845 E mono : at System.CodeDom.Compiler.TempFileCollection.Delete () [0x00000] in <filename unknown>:0
07-09 12:09:52.054 2792 2845 E mono : at System.CodeDom.Compiler.TempFileCollection.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0
07-09 12:09:52.054 2792 2845 E mono : at System.CodeDom.Compiler.TempFileCollection.Finalize () [0x00000] in <filename unknown>:0
07-09 12:09:52.058 2792 2816 I Unity : Remote: Register for the event decoration
07-09 12:09:52.058 2792 2816 I Unity :
07-09 12:09:52.058 2792 2816 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
07-09 12:09:52.058 2792 2816 I Unity :
07-09 12:09:52.445 2792 2845 E mono :
07-09 12:09:52.445 2792 2845 E mono : Unhandled Exception: System.IO.DirectoryNotFoundException: Directory '/tmp/42117940' not found.
07-09 12:09:52.445 2792 2845 E mono : at System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mas
k, FileAttributes attrs) [0x00000] in <filename unknown>:0
07-09 12:09:52.445 2792 2845 E mono : at System.IO.Directory.GetDirectories (System.String path, System.String searchPattern) [0x00000] in <filename u
nknown>:0
07-09 12:09:52.445 2792 2845 E mono : at System.IO.Directory.GetDirectories (System.String path) [0x00000] in <filename unknown>:0
07-09 12:09:52.445 2792 2845 E mono : at System.IO.Directory.RecursiveDelete (System.String path) [0x00000] in <filename unknown>:0
07-09 12:09:52.445 2792 2845 E mono : at System.IO.Directory.Delete (System.String path, Boolean recursive) [0x00000] in <filename unknown>:0
07-09 12:09:52.445 2792 2845 E mono : at System.CodeDom.Compiler.TempFileCollection.Delete () [0x00000] in <filename unknown>:0
07-09 12:09:52.445 2792 2845 E mono : at System.CodeDom.Compiler.TempFileCollection.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0
07-09 12:09:52.445 2792 2845 E mono : at System.CodeDom.Compiler.TempFileCollection.Finalize () [0x00000] in <filename unknown>:0
07-09 12:09:52.457 2792 2816 I Unity : Remote 1 - << HIDDEN >>
07-09 12:09:52.457 2792 2816 I Unity :
07-09 12:09:52.457 2792 2816 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
07-09 12:09:52.457 2792 2816 I Unity :
07-09 12:09:52.457 2792 2816 I Unity : Firebase: Start Firebase initialization.
07-09 12:09:52.457 2792 2816 I Unity :
07-09 12:09:52.457 2792 2816 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
07-09 12:09:52.457 2792 2816 I Unity :
07-09 12:09:53.012 983 3932 I libPerfService: perfGetLastBoostPid 2792
07-09 12:09:53.012 983 3932 I libPerfService: perfGetLastBoostPid 2792
07-09 12:09:53.194 2792 2816 I Unity : IAP: Already initialized, call the event!
07-09 12:09:53.194 2792 2816 I Unity :
07-09 12:09:53.194 2792 2816 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
07-09 12:09:53.194 2792 2816 I Unity :
07-09 12:09:53.302 2792 3201 E CRASH : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
07-09 12:09:53.302 2792 3201 E CRASH : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-09 12:09:53.302 2792 3201 E CRASH : Build fingerprint: 'Sony/E5303/E5303:6.0/27.3.A.0.173/787451123:user/release-keys'
07-09 12:09:53.302 2792 3201 E CRASH : Revision: '0'
07-09 12:09:53.302 2792 3201 E CRASH : pid: 2792, tid: 3201, name: Thread-8408 >>> com.hammurabigames.cookinggame <<<
07-09 12:09:53.302 2792 3201 E CRASH : r0 00000000 r1 cc6bde60 r2 d119fcdc r3 d6954448
07-09 12:09:53.302 2792 3201 E CRASH : r4 00000000 r5 d23d4380 r6 cad4bc00 r7 d23dd900
07-09 12:09:53.302 2792 3201 E CRASH : r8 cc261268 r9 da74d494 sl cc5be000 fp cc6bde50
07-09 12:09:53.302 2792 3201 E CRASH : ip cc4589a7 sp cc6bde40 lr d119fcec pc cc459ee4 cpsr 31353437
07-09 12:09:53.302 2792 3201 E CRASH :
07-09 12:09:53.302 2792 3201 E CRASH : backtrace:
07-09 12:09:53.304 2792 3201 E CRASH : #00 pc 0004eee4 /data/app/com.hammurabigames.cookinggame-1/lib/arm/libApp.so (firebase::auth::Auth::current_use
r()+3)
07-09 12:09:53.305 2792 3201 E CRASH : #01 pc 00002ce8 ( (wrapper managed-to-native) Firebase.Auth.AuthUtilPINVOKE:FirebaseAuth_CurrentUser_get (Syst
em.Runtime.InteropServices.HandleRef) + 0x48 (0xd119fca0 0xd119fd28) [0xd97aaee0 - Unity Root Domain]+11496)
07-09 12:09:53.305 2792 3201 E CRASH :
07-09 12:09:53.305 2792 3201 E CRASH : stack:
07-09 12:09:53.306 2792 3201 E CRASH : cc6bde00 cc6bde90
07-09 12:09:53.306 2792 3201 E CRASH : cc6bde04 dca095f8 /data/app/com.hammurabigames.cookinggame-1/lib/arm/libunity.so
07-09 12:09:53.306 2792 3201 E CRASH : cc6bde08 dd1f5ff0 /data/app/com.hammurabigames.cookinggame-1/lib/arm/libunity.so
07-09 12:09:53.306 2792 3201 E CRASH : cc6bde0c 00000001
07-09 12:09:53.306 2792 3201 E CRASH : cc6bde10 d9b5dc10 /data/app/com.hammurabigames.cookinggame-1/lib/arm/libmono.so
07-09 12:09:53.306 2792 3201 E CRASH : cc6bde14 d9a504dc /data/app/com.hammurabigames.cookinggame-1/lib/arm/libmono.so
07-09 12:09:53.306 2792 3201 E CRASH : cc6bde18 00000001
07-09 12:09:53.306 2792 3201 E CRASH : cc6bde1c 00000000
07-09 12:09:53.306 2792 3201 E CRASH : cc6bde20 00000000
07-09 12:09:53.306 2792 3201 E CRASH : cc6bde24 d6954440 [anon:libc_malloc]
07-09 12:09:53.306 2792 3201 E CRASH : cc6bde28 cc6bde4c
07-09 12:09:53.306 2792 3201 E CRASH : cc6bde2c d97e047c /data/app/com.hammurabigames.cookinggame-1/lib/arm/libmono.so
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde30 70233a00 /data/dalvik-cache/arm/system@framework@boot.art
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde34 00000000
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde38 00000000
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde3c d6954440 [anon:libc_malloc]
07-09 12:09:53.307 2792 3201 E CRASH : #00 cc6bde40 00000000
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde44 cc6bde60
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde48 d9b5dc10 /data/app/com.hammurabigames.cookinggame-1/lib/arm/libmono.so
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde4c d119fcec
07-09 12:09:53.307 2792 3201 E CRASH : #01 cc6bde50 d6547948 [anon:libc_malloc]
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde54 00000000
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde58 00000000
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde5c 00001000
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde60 cf276180 [anon:libc_malloc]
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde64 d6954448 [anon:libc_malloc]
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde68 d9b5dc10 /data/app/com.hammurabigames.cookinggame-1/lib/arm/libmono.so
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde6c d9a504dc /data/app/com.hammurabigames.cookinggame-1/lib/arm/libmono.so
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde70 cc6bde50
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde74 d119fcdc
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde78 d23d4380
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde7c d6954440 [anon:libc_malloc]
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde80 cc6bde94
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde84 d99c09c8 /data/app/com.hammurabigames.cookinggame-1/lib/arm/libmono.so (mono_object_isinst+160
)
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde88 d6547948 [anon:libc_malloc]
07-09 12:09:53.307 2792 3201 E CRASH : cc6bde8c e6ab0a98
07-09 12:09:53.307 2792 3201 E CRASH :
07-09 12:09:53.307 2792 3201 E CRASH : code around pc:
07-09 12:09:53.307 2792 3201 E CRASH : cc459ec4 107687f0 e7b5230a 00060e90 00060e30 ..v..#......0...
07-09 12:09:53.308 2792 3201 E CRASH : cc459ed4 0004ae91 0004ae0a 0004ae14 4604b513 ...............F
07-09 12:09:53.308 2792 3201 E CRASH : cc459ee4 300c6800 f7f59001 6823fccb b10c6d5c .h.0......#h\m..
07-09 12:09:53.308 2792 3201 E CRASH : cc459ef4 0448f103 f7f5a801 4620fcd3 bd10b002 ..H....... F....
07-09 12:09:53.308 2792 3201 E CRASH : cc459f04 68186803 b5734770 68054606 f105460c .h.hpGs..F.h.F..
07-09 12:09:53.308 2792 3201 E CRASH : cc459f14 90010088 fcb4f7f5 6eeb6f29 461a428b ........)o.n.B.F
07-09 12:09:53.308 2792 3201 E CRASH : cc459f24 6810d009 42a03304 f851d1f8 60133c04 ...h.3.B..Q..<.`
07-09 12:09:53.308 2792 3201 E CRASH : cc459f34 3a046f2a 68a1e002 e0056863 429a6f2b *o.:...hch..+o.B
07-09 12:09:53.308 2792 3201 E CRASH : cc459f44 3b04d0f9 e7f9672b 461a428b 6810d009 ...;+g...B.F...h
07-09 12:09:53.308 2792 3201 E CRASH : cc459f54 42b03304 f851d1f8 60133c04 3a0468a2 .3.B..Q..<.`.h.:
07-09 12:09:53.308 2792 3201 E CRASH : cc459f64 a801e004 fc9cf7f5 bd70b002 429a68a3 ..........p..h.B
07-09 12:09:53.308 2792 3201 E CRASH : cc459f74 3b04d0f7 e7f960a3 4606b573 460c6805 ...;.`..s..F.h.F
07-09 12:09:53.308 2792 3201 E CRASH : cc459f84 0088f105 f7f59001 6fe9fc7b 428b6fab ........{..o.o.B
07-09 12:09:53.308 2792 3201 E CRASH : cc459f94 d009461a 33046810 d1f842a0 3c04f851 .F...h.3.B..Q..<
07-09 12:09:53.308 2792 3201 E CRASH : cc459fa4 6fea6013 e0023a04 686368a1 6febe005 .`.o.:...hch...o
07-09 12:09:53.309 2792 3201 E CRASH : cc459fb4 d0f9429a 67eb3b04 428be7f9 d009461a .B...;.g...B.F..
07-09 12:09:53.309 2792 3201 E CRASH :
07-09 12:09:53.309 2792 3201 E CRASH : code around lr:
07-09 12:09:53.309 2792 3201 E CRASH : d119fccc e5801000 e581d010 e1a0200f e5812014 ......... ... ..
07-09 12:09:53.309 2792 3201 E CRASH : d119fcdc e28b0004 e2800004 e5900000 ebfff506 ................
07-09 12:09:53.309 2792 3201 E CRASH : d119fcec e58b0000 e303011c e34d09b6 e5900000 ..........M.....
07-09 12:09:53.309 2792 3201 E CRASH : d119fcfc e3500000 1a000006 e59b0000 e28b2010 ..P.......... ..
07-09 12:09:53.309 2792 3201 E CRASH : d119fd0c e592c000 e592e004 e58ec000 e282d068 ............h...
07-09 12:09:53.309 2792 3201 E CRASH : d119fd1c e89daff0 ebfff4f5 eafffff6 e1a0c00d ................
07-09 12:09:53.309 2792 3201 E CRASH : d119fd2c e92d59f0 e24dd018 e1a0b00d e1a06000 .Y-...M......`..
07-09 12:09:53.309 2792 3201 E CRASH : d119fd3c e1a07001 e3a00000 e58b0000 e3a00000 .p..............
07-09 12:09:53.309 2792 3201 E CRASH : d119fd4c e58b0004 e3a00000 e58b0008 e5960008 ................
07-09 12:09:53.309 2792 3201 E CRASH : d119fd5c e58b0000 ebfff4d9 e5966008 e28b0004 .........`......
07-09 12:09:53.309 2792 3201 E CRASH : d119fd6c e1a01007 eb5c5c18 e28b5004 e5951004 .....\\..P......
07-09 12:09:53.309 2792 3201 E CRASH : d119fd7c e1a00006 e596e000 eb000025 e597e000 ........%.......
07-09 12:09:53.309 2792 3201 E CRASH : d119fd8c e5970010 e3a06001 e30c5428 e34c5c75 .....`..(T..u\L.
07-09 12:09:53.309 2792 3201 E CRASH : d119fd9c e3500000 0a000006 e597e000 e5971010 ..P.............
07-09 12:09:53.310 2792 3201 E CRASH : d119fdac e1a00001 e591e000 eb4553b7 e1a04000 .........SE..@..
07-09 12:09:53.310 2792 3201 E CRASH : d119fdbc ea000001 e30c4500 e34c4c77 e1a00005 .....E..wLL.....
07-09 12:09:54.013 983 4780 I libPerfService: perfGetLastBoostPid 2792
07-09 12:09:54.013 983 4780 I libPerfService: perfGetLastBoostPid 2792
07-09 12:09:54.341 2792 2816 E CRASH : other thread is trapped; signum = 11
07-09 12:09:54.344 2792 2816 E AndroidRuntime: FATAL EXCEPTION: UnityMain
07-09 12:09:54.344 2792 2816 E AndroidRuntime: Process: com.hammurabigames.cookinggame, PID: 2792
07-09 12:09:54.344 2792 2816 E AndroidRuntime: java.lang.Error: FATAL EXCEPTION [UnityMain]
07-09 12:09:54.344 2792 2816 E AndroidRuntime: Unity version : 2017.2.3f1
07-09 12:09:54.344 2792 2816 E AndroidRuntime: Device model : Sony E5303
07-09 12:09:54.344 2792 2816 E AndroidRuntime: Device fingerprint: Sony/E5303/E5303:6.0/27.3.A.0.173/787451123:user/release-keys
07-09 12:09:54.344 2792 2816 E AndroidRuntime:
07-09 12:09:54.344 2792 2816 E AndroidRuntime: Caused by: java.lang.Error: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
07-09 12:09:54.344 2792 2816 E AndroidRuntime: Build fingerprint: 'Sony/E5303/E5303:6.0/27.3.A.0.173/787451123:user/release-keys'
07-09 12:09:54.344 2792 2816 E AndroidRuntime: Revision: '0'
07-09 12:09:54.344 2792 2816 E AndroidRuntime: pid: 2792, tid: 3201, name: Thread-8408 >>> com.hammurabigames.cookinggame <<<
07-09 12:09:54.344 2792 2816 E AndroidRuntime: r0 00000000 r1 cc6bde60 r2 d119fcdc r3 d6954448
07-09 12:09:54.344 2792 2816 E AndroidRuntime: r4 00000000 r5 d23d4380 r6 cad4bc00 r7 d23dd900
07-09 12:09:54.344 2792 2816 E AndroidRuntime: r8 cc261268 r9 da74d494 sl cc5be000 fp cc6bde50
07-09 12:09:54.344 2792 2816 E AndroidRuntime: ip cc4589a7 sp cc6bde40 lr d119fcec pc cc459ee4 cpsr 31353437
07-09 12:09:54.344 2792 2816 E AndroidRuntime:
07-09 12:09:54.344 2792 2816 E AndroidRuntime: at libApp.firebase::auth::Auth::current_user()(auth:3)
07-09 12:09:54.344 2792 2816 E AndroidRuntime: at Unknown.00002ce8(Unknown Source)
07-09 12:09:54.398 3545 3545 I AEE/AED : [OnPurpose Redunant in void preset_info(aed_report_record*, int, int)] pid: 2792, tid: -1361051648, name: UNKNOWN
>>> com.hammurabigames.cookinggame <<<
在崩溃日志的底部,您可以在libApp.firebase :: auth :: Auth :: current_user()(auth:3)看到堆栈跟踪。