1

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>
Andy Dennie
  • 6,012
  • 2
  • 32
  • 51
  • 1
    this has been said a thousand times - please see what's logged in your LogCat and if you still got the problem post the log here. Nobody is able to help you at this point. – Nika Kasradze Oct 18 '16 at 13:19
  • Hey, Any chance we can get the logcat as Nika suggested .. ? – ahamino Oct 18 '16 at 18:19
  • Hi Nika and ahamino. I added the logcat file as asked, and I've read it but can't really make sense of it. At least nothing that looks directly relatable to the problem. Also, latest finding is that crashes are delayed per scene if I load the next scene asynchronously. – Diogo Duarte Oct 20 '16 at 16:23
  • I don't see the crash in that logcat output. Can you run again (don't just filter for errors) and capture the crash output in the log? – Andy Dennie Oct 20 '16 at 18:18
  • Hi @andy, thank you for the tip! I ran it and this time it was more informative. Line 37511 states about SYSTEM_TOMBSTONE but I haven't reached any conclusion yet. I'm clueless about logcat files, Android dev is quite new for me. I've been googling this output but still not sure what would cause it. Any clues? – Diogo Duarte Oct 22 '16 at 15:06
  • I've plucked out the relevant logcat output and added it to the edited question above. The cause is not apparent; something is going south inside the native Mono runtime. I've seen a similar crash before under similar circumstances, so it's probably not you. Will update you when I have new info. – Andy Dennie Oct 24 '16 at 21:56
  • When you change scenes, do you stop and restart a singleton instance of a Detector, or do you stop the first scene's Detector, then create and start a new Detector for the new scene? – Andy Dennie Oct 24 '16 at 22:03
  • Hi Andy. Thank you for your edit. In this case, only one scene uses the affdex Detector, so I simply switch scenes. I tried destroying it with the `Destroy(obj)` function, but it didn't make any difference in the crash result. PS: I've narrowed the crash down to: starting with affectiva's example scene, then switch to another basic scene by the click of a button. The crash still happens. This behaviour is kept even with asynchronous scene loading (I thought there would be a chance to have a crash due to memory constraints in Android) – Diogo Duarte Oct 27 '16 at 14:11

1 Answers1

0

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.

  • 1
    Hi @Forest. Yes - upon following your youtube tutorial, I used Destroy(obj) for the Detector and Camera Input. These were triggered by the same mechanism for switching scenes. Please let me know if by "destroy" and "respawn" you mean anything else/ other unity function. Also, have you had a successful implementation of the SDK in a multi-scene unity game? I could only bypass this problem using a virtual scene manager for switching canvas on and off, but there's only so much it can do... Thanks ;) – Diogo Duarte Jan 11 '17 at 16:40
  • Hi @DiogoDuarte, yes, Nevermind uses scene switching (via Application.LoadLevelAsync). Nevermind is a desktop game though. I also know of another game that changes scenes and works on iOS. Let's connect offline and discuss further. I have some ideas I'd prefer not to share publicly. Please email me at forest.handford@affectiva.com . – Forest J. Handford Jan 11 '17 at 18:18