问题
I've been developing an application for emotion recognition using Affectiva's affdex-sdk (v2.2) for Unity 5.4. My application consists of 3 scenes, then I use affectiva's Camera_Detector
scene, and use an emotion as trigger to go to the next scene.
It runs perfectly in UnityEditor and as a Windows compiled package (x86). However when I deploy it to Android (5.0), crashes occur always at runtime when skipping from Camera_Detector
scene to the next scene (scene loads previous to Camera_Detector
and in Camera_Detector
itself never crash).
I'm using (in C#)
SceneManager.LoadScene("nextscene");
The Android device simply displays "Unfortunately, affdex_emotapp" has stopped.
Is there any chance to get this to work under Android?
Here is the crash output from logcat:
F/libc (15037): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x898f0308 in tid 15053 (UnityMain)
I/DEBUG ( 247): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 247): Build fingerprint: samsung/matissevewifixx/matissevewifi:5.1.1/LMY47X/T533XXU1BOI3:user/release-keys'
I/DEBUG ( 247): Revision: '2'
I/DEBUG ( 247): ABI: 'arm'
I/DEBUG ( 247): pid: 15037, tid: 15053, name: UnityMain >>> com.ibeb.emoface_cam <<<
I/DEBUG ( 247): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr x898f0308
I/DEBUG ( 247): r0 898f0308 r1 898f1000 r2 fffffe8c r3 898f1000
I/DEBUG ( 247): r4 898f0308 r5 00000001 r6 898f0ffc r7 b42c7000
I/DEBUG ( 247): r8 845d408c r9 b91d9718 sl 00000001 fp a2b4e1a4
I/DEBUG ( 247): ip a4110ee0 sp a2b4e178 lr a4031b34 pc a4031aa4 cpsr 80070010
I/DEBUG ( 247):
I/DEBUG ( 247): backtrace:
I/DEBUG ( 247): #00 pc 002b3aa4 /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so
I/DEBUG ( 247): #01 pc 002b3b30 /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so (GC_push_all_stack+72)
I/DEBUG ( 247): #02 pc 002bc7bc /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so
I/DEBUG ( 247): #03 pc 002bc88c /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so
I/DEBUG ( 247): #04 pc 002b85f8 /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so
I/DEBUG ( 247): #05 pc 002b55ec /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so
I/DEBUG ( 247): #06 pc 002b1ee0 /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so
I/DEBUG ( 247): #07 pc 002abfb4 /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so
I/DEBUG ( 247): #08 pc 002aba98 /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so
I/DEBUG ( 247): #09 pc 002ad144 /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so
I/DEBUG ( 247): #10 pc 002b0b50 /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so
I/DEBUG ( 247): #11 pc 002b1080 /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so
I/DEBUG ( 247): #12 pc 002b12e8 /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so
I/DEBUG ( 247): #13 pc 001f5a04 /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so
I/DEBUG ( 247): #14 pc 001f69fc /data/app/com.ibeb.emoface_cam-2/lib/arm/libmono.so (mono_array_new_specific+232)
I/DEBUG ( 247): #15 pc 0000280c <unknown>
回答1:
This sounds related to this issue covered in the developer portal:
"When you switch scenes, you need to destroy and respawn the Detector and CameraInput. If you do not respawn these components, Unity’s camera interface will get a frozen image at reload, thus causing the metrics to continually come from the image taken at the scene transition." - http://developer.affectiva.com/v2_3/unity/analyze-camera/
Are you destroying and respawning the Detector and CameraInput.
来源:https://stackoverflow.com/questions/40109342/aafdex-sdk-unity3d-crash-on-scene-transition-only-on-android