Start a new topic

Application crashes with Camera2 enabled in Release Build & How to check if Camera2 is supported ?

Hello,

We are using Unity 2020.3.2 to build for Android.

We are using the Wikitude SDK 9.6 Professional Edition.


We are facing a crash on an Android device when the "Enable Camera2 API" is checked on the WikitudeCamera prefab. The application crashes as soon as the camera starts.

However, the crash only occurs in Release builds. If we check "Development Build" in the Unity Build Setting or if we add" DEBUG" to the Scripting Define Symbols, the crash doesn't happen.

The Scripting Backend must be IL2CPP.


We have tried to set the "Camera API2 Support Level" to "Level_3" or "Full" with no difference.

If we uncheck the "Enable Camera2 API" option, the application does not crash.


The device crashing is a Galaxy Tab 7, Android 11.


We have used the application "Camera2 Probe" available on the PlayStore to check the Camera2 APi compatibility with somes devices that do not crash to compare with the one that crashes. I have attached the results as screenshots.

All devices state they support Camera2 API at a "LEVEL_3" level.

The only clear difference I can see is the "Stabilization Modes" -> "Video" is not available on the device that is crashing.


Your documentation states "Please note that the camera2 api has issues on several devices which is why it is disabled by default."
But how can we know in advance if the device actually supports the Camera2 API ? We can't afford to make the application crash randomly.


I have also attached the Logcat of the Crash.


I haven't had the time to test with the Wikitude samples, I will try when I am back from holidays if you did not answer yet.


Thanks in advance for any help you can provide.


Regards,

Thales team

txt

Hello TeamThales,


I'm sorry to hear that you're having troubles again.

I've tested the issue you've mentioned with some of our older testing devices (Samsung M20, Samsung Galaxy S8 and Samsung Galaxy S9+) and the Wikitude SDK 9.6 Professional Edition samples. Unfortunately I couldn't reproduce mentioned issue.


However, from what I've found this is not a software issue but one that's cause by certain Android devices because some simply don't support the Camera2 API (or at least not fully). Although most guides I've found on how to check the Camera2 support point to the same app you've already tried, this StackOverflow post shows how to check this in Java code. This is a very tricky and frustrating limitation for mobile developers indeed.


Despite not having good news I hope I could at least help you out a bit.


With best regards,

Peter

Hello,


I wouldn't say the Galaxy Tab S7 is an old device, as it was released in 2020.

We also have a Galaxy Tab A7, witch was also released in 2020 and a lot let powerful, not crashing with Camera2 enabled.


The StackOverflow post you linked or the Camera2 Probe application are not of any help : as you can see on the screenshots I attached previously, all the devices state "LEVEL_3" for the "Hardware Support Level", but only one of them is crashing. So theoretically, the crashing device DO support the Camera2 API.


About the screenshots I attached previously :

- One is named "Camera2 Probe SmartPhone - NO CRASH"

- One is named "Camera2 Probe Galaxy Tab A7 - NO CRASH"

- One is named "Camera2 Probe Galaxy Tab S7 - CRASH"


I just noticed by looking again at the CRASH screenshot that the S7 device shows 4 different cameras :

- CameraID : 0, Position BACK, Hardware Support Level : LEVEL_3

- CameraID : 1, Position FRONT, Hardware Support Level : LEVEL_3

- CameraID : 2, Position BACK, Hardware Support Level : LIMITED

- CameraID : 3, Position FRONT, Hardware Support Level : LIMITED


Have you ever encountered a similar case with different cameras for FRONT / BACK positions ?

Can we know which one is actually used ?

Do you think the crash could come from another hardware issue ?


Regards,

Thales team

Hi,


The camera 2 issues on supported devices is usually related to a misconfiguration on our side due to not have this specific device. Since we cannot reproduce the issue on our end, I have several questions to gather more info:

  • Is the issue just happening in the Galaxy Tab S7 or were you able to reproduce in other devices?
  • Were you able to reproduce not only with your sample but also with our sample application?
  • Did you try our latest 9.13.0 version? We have fixed some minor issues with the camera 2 lately which might be related to your current issue.
  • Did you manage to get some logs with more info? The current log points to a specific method which I don't think it's the root cause of this.


Best regards,

Aitor.


Login or Signup to post a comment