ARCore Black Camera Feed After Restarting AR Session on 1st Launch

–Steps to reproduce–

Create a new ARTemplate Project for Android
Deploy on your Android Phone
Start Application (Bug only happens first time opening after deployment, keep that in mind)
Start AR Mode (Camera Feed comes in)
Stop AR Mode (Camera feed stops. Black screen. This is intended)
Start AR Mode (Black Screen. No Camera Feed coming)
–Results–

Get a black screen instead of the camera feed, nothing fixes this apart from a app restart

–Intended–

Should see camera feed, instead get black screen

–What happens–

Restarting Google ARCore session(Android) causes a black screen where the camera feed should be on the initial run-through of the deployed app.
AR will work on first “Start AR Session” but if you call “Stop AR Session” and then start it again with "Start AR Session: it will cause a black camera feed.

–Logs–

Logcat results when you get black camera feed:
2020-07-09 06:44:47.248 24620-24639/? E/libEGL: eglCreateContext:1132 error 3006 (EGL_BAD_CONTEXT)
2020-07-09 06:44:47.249 24620-24639/? E/native: error_policy_util.cc:261 
    ################ ARCore Native Error ##################
    BUILD_CHANGELIST:331869482
    BUILD_BASELINE_CHANGELIST:331085015
    ################### Stack Trace Begin ################
    ARCoreError: third_party/arcore/ar/core/android/implementation/android_frame_manager_gl.cc:346	https://cs.corp.google.com/piper///depot/google3/third_party/arcore/ar/core/android/implementation/android_frame_manager_gl.cc?g=0&l=346
    ARCoreError: third_party/arcore/ar/core/android/implementation/android_frame_manager_gl.cc:52	https://cs.corp.google.com/piper///depot/google3/third_party/arcore/ar/core/android/implementation/android_frame_manager_gl.cc?g=0&l=52
    ARCoreError: third_party/arcore/ar/core/frame_manager_legacy.cc:331	https://cs.corp.google.com/piper///depot/google3/third_party/arcore/ar/core/frame_manager_legacy.cc?g=0&l=331
    ARCoreError: third_party/arcore/ar/core/frame_manager_legacy.cc:242	https://cs.corp.google.com/piper///depot/google3/third_party/arcore/ar/core/frame_manager_legacy.cc?g=0&l=242
    ARCoreError: third_party/arcore/ar/core/session.cc:1503	https://cs.corp.google.com/piper///depot/google3/third_party/arcore/ar/core/session.cc?g=0&l=1503
    ARCoreError: third_party/arcore/ar/core/c_api/session_lite_c_api.cc:75	https://cs.corp.google.com/piper///depot/google3/third_party/arcore/ar/core/c_api/session_lite_c_api.cc?g=0&l=75
    ################### Stack Trace End #################
2020-07-09 06:44:47.251 987-987/? E/CameraService: checkTemperature (0)
2020-07-09 06:44:47.251 24620-24639/? E/native: status.cc:161 FAILED_PRECONDITION: 
    ARCoreError: third_party/arcore/ar/core/session.cc:2408
     at third_party/arcore/ar/core/session.cc:2408 [type.googleapis.com/util.ErrorSpacePayload='ArStatusErrorSpace::AR_ERROR_NOT_YET_AVAILABLE']
2020-07-09 06:44:47.253 987-987/? E/CameraService: setCompanionDisableSysFs : cc.disable property set to 0

–How to reproduce–

Can be replicated with default AR Template project in Unreal Launcher

I can confirm I’m also having the same problem on my Galaxy S7

I can also confirm this happens on a project that has worked fine in 4.23, 4.24, and 4.25.

4.26 is the only version of the engine that shows a black screen on session restart/resume. Tested on a Galaxy S9

Same here on Xiamo Pocophone F1, Huawei P20 Pro and Samsung Tab S4.

same happening for me on Galaxy S8 and Galaxy S20
Hope there will be a solution soon

Still not fix. It’s a BIG PROBLEM. Existed since 4.24.

any solutions guys ?

Weirdly enough It worked when i unplugged the phone’s connection to the pc and restarted the app
Using 4.26

I too have same problem when i even start the app after installing. my phone is vivo v5. it seems that google ARCore has so many bugs with unreal engine

does anyone know if this has been fixed? i migrated my project to 4.26 as well, but this is still happening. is there anything that needs to be called in code/blueprints other than start ar session or stop ar session in terms of loading configs? i believe this error was related to camera permissions not being updated at runtime or something…(which i guess is related to runtime android manifest updates?)

As of today with the full release of 4.27 the bug is still not fixed. Can confirm that the output log returns error code ArSession_create returns with error: -9 which according to Googles docs means: AR_ERROR_CAMERA_PERMISSION_NOT_GRANTED = -9. But when checked if the permission is still granted we receive true. So it is still not possible to restart an AR session on Android either manually nor automatically.

i was hoping to check into this again as well with 4.27.
can you post where / which lines of code do the camera permissions checks?
i’ll dig around and see what i can find too.

Hi paradoc,

this would be very much appreciated if we could find a solution to this. I received the error message ArSession_create returns with error: -9 from the Output Log. Based on the Google documentation and the source code of the engine this error code refers to AR_ERROR_CAMERA_PERMISSION_NOT_GRANTED = -9 (which can be found here \Engine\Plugins\Runtime\AR\Google\GoogleARCore\Source\GoogleARCoreBase\Private\GoogleARCoreAPI.h) Therefore I searched the source code for mentions of “ArSession” and found these source files: \UE_4.27\Engine\Source\ThirdParty\GoogleARCore\include\arcore_c_api.h and \UE_4.27\Engine\Source\ThirdParty\GoogleARCore\include\arcore_ios_c_api.h. At least there seems to be the origin of the “ArSession_create” function. I am not a C++ pro so I’m not sure if this is helpful or not at this point. Other source files worth mentioning: \UE_4.27\Engine\Source\Runtime\AugmentedReality\Private\ARSupportInterface.cpp and UE_4.27\Engine\Source\Runtime\AugmentedReality\Public\ARSystem.h, but I wasn’t able to spot the camera permission call there at a quick glance.

thanks for posting this. i’m guessing it’s a delegate callback that’s breaking somewhere since this is all latent. will look into it and see…

Hi paradoc,

have you been able to make any progress on the matter?
I am creating another bug report at this exact moment, since the 1st one was either ignored or never reviewed. I will let you guys know if I receive a bug tracking number.

1 Like

Unfortunately I am having the same problem in 4.27. Did anyone find any type of workaround (beyond not stopping the AR session), or a solution?
Thanks in advance for any kind of information. :slightly_smiling_face:

Hi there. As things stand right know, it seems that the issue arises if you also ask for storage permission. It’s not about “when” but more “if” you ask for storage permission. So, if you don’t need storage permission you should be able to remove that and also get rid of the black screen issue (was tested in 4.27.2)

Hi, thank you for the fast reply.

I tried to remove the storage permission, both by modifying the manifest in the Intermediate folder (as a temporarily fix), and also by using the ManifestRequirementsOverride.txt file in Build/Android. I haven’t tried with UPL yet, but I followed the instructions from here.
However, in this case the AR doesn’t start at all, not even the first time.

Could you please give me more info on how you resolved or removed that permission? That would greatly help, thanks in advanced! :slightly_smiling_face:

unfortunately, I tested on ue4 4.27.2 and still have some problems with a blacklight on the first try after the AR Camera running is no problem before I press the button back to the main menu with its HUD. Widget. The problem may occur when still on the first ar session after restarting the apps and blacklight disappear, but it’s a problem on release apps for users…