- Home /
Crashes when calling "WebCamTexture.devices".
Crashes when calling "WebCamTexture.devices". Only the actual device with the built apk installed crashes with the following error. Please let me know if there is a solution.
Unity 2020.2.7f1 Unity 2020.3.0f1
03-22 15:28:22.501 12912 12959 I CameraManagerGlobal: Connecting to camera service 03-22 15:28:22.510 12912 12959 I Unity : Camera2: focal length5.11 03-22 15:28:22.510 12912 12959 I Unity : Camera2: sensor size 7.344 x 5.9904 03-22 15:28:22.510 12912 12959 I Unity : Camera2: focal length equivalent 25 03-22 15:28:22.517 12912 12959 I Unity : Camera2: focal length2.47 03-22 15:28:22.517 12912 12959 I Unity : Camera2: sensor size 3.6825602 x 2.82464 03-22 15:28:22.517 12912 12959 I Unity : Camera2: focal length equivalent 24 03-22 15:28:22.521 12912 12959 I Unity : Camera2: focal length5.11 03-22 15:28:22.521 12912 12959 I Unity : Camera2: sensor size 7.344 x 5.9904 03-22 15:28:22.521 12912 12959 I Unity : Camera2: focal length equivalent 25 03-22 15:28:22.527 12912 12959 I Unity : Camera2: focal length6.95 03-22 15:28:22.527 12912 12959 I Unity : Camera2: sensor size 4.2368 x 3.1936002 03-22 15:28:22.527 12912 12959 I Unity : Camera2: focal length equivalent 59 03-22 15:28:22.530 12912 12959 I Unity : Camera2: focal length2.67 03-22 15:28:22.530 12912 12959 I Unity : Camera2: sensor size 5.6671996 x 4.4351997 03-22 15:28:22.530 12912 12959 I Unity : Camera2: focal length equivalent 16 03-22 15:28:22.533 12912 12959 I Unity : Camera2: focal length2.15 03-22 15:28:22.533 12912 12959 F system.templat: java_vm_ext.cc:577] JNI DETECTED ERROR IN APPLICATION: JNI CallBooleanMethodV called with pending exception java.lang.NullPointerException: Attempt to invoke virtual method 'float android.util.SizeF.getWidth()' on a null object reference 03-22 15:28:22.533 12912 12959 F system.templat: java_vm_ext.cc:577] at int com.unity3d.player.b.d(android.content.Context, int) ((null):-1) 03-22 15:28:22.533 12912 12959 F system.templat: java_vm_ext.cc:577] at int com.unity3d.player.Camera2Wrapper.getCamera2FocalLengthEquivalent(int) ((null):-1) 03-22 15:28:22.533 12912 12959 F system.templat: java_vm_ext.cc:577] at boolean com.unity3d.player.UnityPlayer.nativeRender() ((null):-2) 03-22 15:28:22.533 12912 12959 F system.templat: java_vm_ext.cc:577] at boolean com.unity3d.player.UnityPlayer.access$300(com.unity3d.player.UnityPlayer) ((null):-1) 03-22 15:28:22.533 12912 12959 F system.templat: java_vm_ext.cc:577] at boolean com.unity3d.player.UnityPlayer$e$1.handleMessage(android.os.Message) ((null):-1) 03-22 15:28:22.533 12912 12959 F system.templat: java_vm_ext.cc:577] at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102) 03-22 15:28:22.533 12912 12959 F system.templat: java_vm_ext.cc:577] at void android.os.Looper.loop() (Looper.java:368) 03-22 15:28:22.533 12912 12959 F system.templat: java_vm_ext.cc:577] at void com.unity3d.player.UnityPlayer$e.run() ((null):-1) 03-22 15:28:22.533 12912 12959 F system.templat: java_vm_ext.cc:577] 03-22 15:28:22.533 12912 12959 F system.templat: java_vm_ext.cc:577] in call to CallBooleanMethodV 03-22 15:28:22.533 12912 12959 F system.templat: java_vm_ext.cc:577] from boolean com.unity3d.player.UnityPlayer.nativeRender() 03-22 15:28:22.648 12912 12959 F system.templat: runtime.cc:655] Runtime aborting... 03-22 15:28:22.648 12912 12959 F system.templat: runtime.cc:655] Dumping all threads without mutator lock held 03-22 15:28:22.648 12912 12959 F system.templat: runtime.cc:655] All threads: 03-22 15:28:22.648 12912 12959 F system.templat: runtime.cc:655] DALVIK THREADS (36): 03-22 15:28:22.648 12912 12959 F system.templat: runtime.cc:655] "UnityMain" prio=5 tid=28 Runnable 03-22 15:28:22.648 12912 12959 F system.templat: runtime.cc:655] | group="" sCount=0 dsCount=0 flags=0 obj=0x13e44808 self=0x77a641e0f0 03-22 15:28:22.648 12912 12959 F system.templat: runtime.cc:655] | sysTid=12959 nice=0 cgrp=default sched=0/0 handle=0x75c13b9cc0 03-22 15:28:22.648 12912 12959 F system.templat: runtime.cc:655] | state=R schedstat=( 2854168693 775561030 12711 ) utm=205 stm=80 core=4 HZ=100 03-22 15:28:22.648 12912 12959 F system.templat: runtime.cc:655] | stack=0x75c12b6000-0x75c12b8000 stackSize=1043KB
Answer by maruhaxx · Mar 31, 2021 at 07:54 AM
After some research, I found the cause. It seems to be a problem with Xperia 1 II.
WebCamTexture.devices is retrieving "CameraCharacteristics.SENSOR_INFO_PHYSICAL_SIZE". CameraID = 5 on Xperia 1 II had a return value of null.
It seems to require a fix on the Unity side to resolve this. Thank you in advance for your help.