arcore-android-sdk icon indicating copy to clipboard operation
arcore-android-sdk copied to clipboard

helllo_ar_java emulator failed to create AR session

Open zhazelton opened this issue 2 years ago • 14 comments

SPECIFIC ISSUE ENCOUNTERED

Failed to create AR session com.google.ar.core.exceptions.fatalexception

hello_ar_java displays this error and a black screen when trying to run in emulator.

I downloaded the google play services for AR apk and installed on the emulator. I have tried many different hardware profiles and API versions and none will successfully display.

Front camera is set to emulated in AVD and rear is virtualscene. Logcat logs are pasted below.

Some APIs display this error, and in some, the app just crashes.

024-03-30 22:03:53.259 4873-4873 native com....core.examples.kotlin.helloar E E0000 00:00:1711850633.259084 4873 session_create_implementation_shared.cc:1283] UNKNOWN: ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:1283 Failed to create java data source utils. ARCoreError: third_party/arcore/ar/infrastructure/android/java_data_source_utils.cc:84 getCameraCharacteristics:851: Unable to retrieve camera characteristics for unknown device 0: No such file or directory (-2) === Source Location Trace: === third_party/arcore/ar/infrastructure/android/jni_util.cc:111 third_party/arcore/ar/infrastructure/android/java_data_source_utils.cc:84 2024-03-30 22:03:53.259 4873-4873 native com....core.examples.kotlin.helloar E E0000 00:00:1711850633.259215 4873 session_create_implementation_shared.cc:1424] UNKNOWN: ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:1424 Failed to create cameras using image subsystem from java stack. ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:1283 Failed to create java data source utils. ARCoreError: third_party/arcore/ar/infrastructure/android/java_data_source_utils.cc:84 getCameraCharacteristics:851: Unable to retrieve camera characteristics for unknown device 0: No such file or directory (-2) === Source Location Trace: === third_party/arcore/ar/infrastructure/android/jni_util.cc:111 third_party/arcore/ar/infrastructure/android/java_data_source_utils.cc:84 third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:1283 2024-03-30 22:03:53.261 4873-5014 third_part..._helper.cc com....core.examples.kotlin.helloar V ~JniHelper: about to detach thread (Called from line 368). 2024-03-30 22:03:53.261 4873-5014 third_part..._helper.cc com....core.examples.kotlin.helloar V ~JniHelper: detached thread (Called from line 368). 2024-03-30 22:03:53.261 4873-4873 native com....core.examples.kotlin.helloar E E0000 00:00:1711850633.261404 4873 error_policy_util.cc:263] ################ ARCore Native Error ################## BUILD_CHANGELIST:612958796 BUILD_BASELINE_CHANGELIST:604173239 ################### Stack Trace Begin ################ ARCoreError: third_party/arcore/ar/infrastructure/android/java_data_source_utils.cc:84 https://cs.corp.google.com/piper///depot/google3/third_party/arcore/ar/infrastructure/android/java_data_source_utils.cc?g=0&l=84 ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:1283 https://cs.corp.google.com/piper///depot/google3/third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc?g=0&l=1283 ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:1424 https://cs.corp.google.com/piper///depot/google3/third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc?g=0&l=1424 ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:2674 https://cs.corp.google.com/piper///depot/google3/third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc?g=0&l=2674 ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:3040 https://cs.corp.google.com/piper///depot/google3/third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc?g=0&l=3040 ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation.cc:398 https://cs.corp.google.com/piper///depot/google3/third_party/arcore/ar/core/android/implementation/session_create_implementation.cc?g=0&l=398 ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation.cc:512 https://cs.corp.google.com/piper///depot/google3/third_party/arcore/ar/core/android/implementation/session_create_implementation.cc?g=0&l=512 ################### Stack Trace End #################

                                                                                                ################### Undecorated Trace Begin  #################
                                                                                                UNKNOWN: 
                                                                                                ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation.cc:398
                                                                                                
                                                                                                ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:3040
                                                                                                
                                                                                                ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:2674
                                                                                                
                                                                                                ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:1424
                                                                                                Failed to create cameras using image subsystem from java stack.
                                                                                                ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:1283
                                                                                                Failed to create java data source utils.
                                                                                                ARCoreError: third_party/arcore/ar/infrastructure/android/java_data_source_utils.cc:84
                                                                                                getCameraCharacteristics:851: Unable to retrieve camera characteristics for unknown device 0: No such file or directory (-2)
                                                                                                === Source Location Trace: === 
                                                                                                third_party/arcore/ar/infrastructure/android/jni_util.cc:111
                                                                                                third_party/arcore/ar/infrastructure/android/java_data_source_utils.cc:84
                                                                                                third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:1283
                                                                                                third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:1424
                                                                                                third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:2674
                                                                                                third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:3040
                                                                                                third_party/arcore/ar/core/android/implementation/session_create_implementation.cc:398
                                                                                                
                                                                                                ################### Undecorated Trace End  #################

2024-03-30 22:03:53.263 4873-4873 HelloArActivity com....core.examples.kotlin.helloar E ARCore threw an exception com.google.ar.core.exceptions.FatalException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at com.google.ar.core.Session.throwExceptionFromArStatus(Session.java:16) at com.google.ar.core.Session.nativeCreateSessionAndWrapperWithFeatures(Native Method) at com.google.ar.core.Session.(Session.java:11) at com.google.ar.core.examples.kotlin.common.helpers.ARCoreSessionLifecycleHelper.tryCreateSession(ARCoreSessionLifecycleHelper.kt:88) at com.google.ar.core.examples.kotlin.common.helpers.ARCoreSessionLifecycleHelper.onResume(ARCoreSessionLifecycleHelper.kt:96) at androidx.lifecycle.FullLifecycleObserverAdapter.onStateChanged(FullLifecycleObserverAdapter.java:42) at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:361) at androidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:300) at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:339) at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:145) at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:131) at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:123) at androidx.lifecycle.ReportFragment.onResume(ReportFragment.java:90) at android.app.Fragment.performResume(Fragment.java:2556) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1346) at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1581) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1642) at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3052) at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:3014) at android.app.FragmentController.dispatchResume(FragmentController.java:207) at android.app.Activity.performResume(Activity.java:8767) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4952) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4995) at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:57) at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:180) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:205) at android.os.Looper.loop(Looper.java:294) at android.app.ActivityThread.main(ActivityThread.java:8177) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) 2024-03-30 22:03:53.272 4873-4873 Compatibil...geReporter com....core.examples.kotlin.helloar D Compat change id reported: 210923482; UID 10192; state: ENABLED 2024-03-30 22:03:53.318 4873-4962 Compatibil...geReporter com....core.examples.kotlin.helloar D Compat change id reported: 247079863; UID 10192; state: DISABLED 2024-03-30 22:03:53.318 4873-4934 EGL_emulation com....core.examples.kotlin.helloar D app_time_stats: avg=2037.11ms min=14.23ms max=4059.99ms count=2 2024-03-30 22:03:53.348 4873-4934 OpenGLRenderer com....core.examples.kotlin.helloar E Unable to match the desired swap behavior. 2024-03-30 22:03:54.337 4873-4962 BLASTBufferQueue com....core.examples.kotlin.helloar E SurfaceView[com.google.ar.core.examples.kotlin.helloar/com.google.ar.core.examples.kotlin.helloar.HelloArActivity]#1 rejecting buffer:active_size=1080x2268, requested_size=1080x2268 buffer{size=1080x2205 transform=0} 2024-03-30 22:03:54.369 4873-4873 Choreographer com....core.examples.kotlin.helloar I Skipped 61 frames! The application may be doing too much work on its main thread.

VERSIONS USED

  • Android Studio: Android Studio Iguana | 2023.2.1 Patch 1 Build #AI-232.10300.40.2321.11567975, built on March 13, 2024 Runtime version: 17.0.9+0--11185874 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 11.0 GC: G1 Young Generation, G1 Old Generation Memory: 4064M Cores: 24 Registry: ide.experimental.ui=true

  • ARCore SDK for Android: v1.42.0

  • Device manufacturer, model, and O/S: Pixel 8 and Pixel 3 XL API 34 (tested on API 33 through 29 and some crash, some display this error)

  • Google Play Services for AR (ARCore): v1.42.0 On Windows, use: adb shell pm dump com.google.ar.core | findstr /i "packages: versionName" versionName=1.42.240360593 On macOS, use: adb shell pm dump com.google.ar.core | egrep -i versionName\|packages:

  • Output of adb shell getprop ro.build.fingerprint: -google/sdk_gphone64_x86_64/emu64xa:14/UE1A.230829.036.A1/11228894:userdebug/dev-keys

STEPS TO REPRODUCE THE ISSUE

WORKAROUNDS (IF ANY)

ADDITIONAL COMMENTS

zhazelton avatar Mar 31 '24 02:03 zhazelton

I download and run the sample today and it seems like this error persists. I am using the hello_ar_kotlin version

21020620 avatar Apr 25 '24 15:04 21020620

Same issue here.

Emulator Properties avd.ini.displayname Pixel Fold API 34 avd.ini.encoding UTF-8 AvdId Pixel_Fold_API_34 disk.dataPartition.size 6442450944 fastboot.chosenSnapshotFile
fastboot.forceChosenSnapshotBoot no fastboot.forceColdBoot no fastboot.forceFastBoot yes hw.accelerometer yes hw.arc false hw.audioInput yes hw.battery yes hw.camera.back virtualscene hw.camera.front emulated hw.cpu.ncore 4 hw.device.hash2 MD5:253a4eaf19dee95e9be9194ced30b3df hw.device.manufacturer Google hw.device.name pixel_fold hw.displayRegion.0.1.height 2092 hw.displayRegion.0.1.width 1080 hw.displayRegion.0.1.xOffset 0 hw.displayRegion.0.1.yOffset 0 hw.dPad no hw.gps yes hw.gpu.enabled yes hw.gpu.mode software hw.initialOrientation landscape hw.keyboard yes hw.keyboard.lid yes hw.lcd.density 420 hw.lcd.height 1840 hw.lcd.width 2208 hw.mainKeys no hw.ramSize 3072 hw.sdCard yes hw.sensor.hinge yes hw.sensor.hinge_angles_posture_definitions 0-30, 30-150, 150-180 hw.sensor.hinge.areas 1080-0-0-1840 hw.sensor.hinge.count 1 hw.sensor.hinge.defaults 180 hw.sensor.hinge.ranges 0-180 hw.sensor.hinge.sub_type 1 hw.sensor.hinge.type 1 hw.sensor.posture_list 1, 2, 3 hw.sensors.orientation yes hw.sensors.proximity yes hw.trackBall no image.androidVersion.api 34 image.sysdir.1 system-images\android-34\google_apis\x86_64
PlayStore.enabled false runtime.network.latency none runtime.network.speed full showDeviceFrame yes skin.dynamic yes tag.display Google APIs tag.id google_apis vm.heapSize 336

Arcore SDK for Andriod version v1.43.

It can detect 2 cameras. But fails to find the default camera. Physical cameras don't match device profile. Camera not found. camera_id=0, cameras count=2

SandeepHub avatar Jun 11 '24 20:06 SandeepHub

@devbridie Could you suggest which version of AR core SDK can be used while this bug is being fixed including compatible OS version and API level.

SandeepHub avatar Jun 12 '24 04:06 SandeepHub

Same issue happens for me, not just on hello_ar_java, but every time I try to create a new AR Session (vial new Session(context) ) on a virtual device, in any project. I tried several device images (Android API 35, Android Vanilla IceCream Android 14 ("UpsideDownCake"), and both Google_Play_Services_for_AR_1.44.0_x86_for_emulator.apk and Google_Play_Services_for_AR_1.45.0_x86_for_emulator.apk. Not a single one works, they all throw the same FatalException. Did anyone find a work-around?

symmetry-max avatar Sep 24 '24 22:09 symmetry-max

Facing the same issue with Google_Play_Services_for_AR_1.45.0_x86_for_emulator.apk, API 35

khattab-dev avatar Oct 01 '24 17:10 khattab-dev

@SandeepHub @khattab-dev @symmetry-max Did you find a solution to this?

ani0075saha avatar Oct 08 '24 22:10 ani0075saha

any solution ?

jefersonjuliani avatar Oct 24 '24 12:10 jefersonjuliani

Still same issue after updating the emulator to 35.2.10 and Google Play Services for AR to 1.46.0.

symmetry-max avatar Nov 03 '24 13:11 symmetry-max

the same for com.google.ar:core:1.47.0 Baklava and UpsideDownCake Update: in my case this might be an issue: Only x86-based Android Emulator architectures are supported. Other architectures such as arm64-v8a, armeabi-v7, are not currently supported. https://developers.google.com/ar/develop/java/emulator#create_avd

bene25 avatar Jan 21 '25 13:01 bene25

You need to make sure that the image you're using IS NOT doing an ABI translation like this

Image

As from the example the Baklava is doing a translated ABI into arm64-v8a which prevents it from running the ARCore as stated here

Desz01ate avatar Apr 24 '25 05:04 Desz01ate

You need to make sure that the image you're using IS NOT doing an ABI translation like this As from the example the Baklava is doing a translated ABI into arm64-v8a which prevents it from running the ARCore as stated here

@Desz01ate Thanks for the answer. In my Android Studio dialog, ABI translation is not displayed, so I'm having trouble understanding what you mean. On the official documentation, it is stated that "Only x86-based Android Emulator architectures are supported. Other architectures such as arm64-v8a, armeabi-v7, are not currently supported." Are you suggesting to use an arm64 system image?

symmetry-max avatar May 03 '25 22:05 symmetry-max

I just tried it again using the latest v1.50.0 which was released 4 days ago, but it still has exactly the same error.

symmetry-max avatar Jul 15 '25 17:07 symmetry-max

I'm also getting the same error in my app when running it in the emulator. Reproduces with Google_Play_Services_for_AR_1.50.0_x86_for_emulator

2025-08-27 22:01:11.229  2510-2510  native                  com.wroclaw.artour                   E  E0000 00:00:1756324871.229804    2510 session_create_implementation_shared.cc:1444] UNKNOWN: 
                                                                                                    ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:1444
                                                                                                    Failed to create java data source utils.
                                                                                                    ARCoreError: third_party/arcore/ar/infrastructure/android/java_data_source_utils.cc:84
                                                                                                    getCameraCharacteristics:1329: Unable to retrieve camera characteristics for unknown device 0: No such file or directory (-2)
                                                                                                    === Source Location Trace: ===
                                                                                                    third_party/arcore/ar/infrastructure/android/jni_util.cc:118
                                                                                                    third_party/arcore/ar/infrastructure/android/java_data_source_utils.cc:84
2025-08-27 22:01:11.229  2510-2510  native                  com.wroclaw.artour                   E  E0000 00:00:1756324871.229881    2510 session_create_implementation_shared.cc:1587] UNKNOWN: 
                                                                                                    ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:1587
                                                                                                    Failed to create cameras using image subsystem from java stack.
                                                                                                    ARCoreError: third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:1444
                                                                                                    Failed to create java data source utils.
                                                                                                    ARCoreError: third_party/arcore/ar/infrastructure/android/java_data_source_utils.cc:84
                                                                                                    getCameraCharacteristics:1329: Unable to retrieve camera characteristics for unknown device 0: No such file or directory (-2)
                                                                                                    === Source Location Trace: ===
                                                                                                    third_party/arcore/ar/infrastructure/android/jni_util.cc:118
                                                                                                    third_party/arcore/ar/infrastructure/android/java_data_source_utils.cc:84
                                                                                                    third_party/arcore/ar/core/android/implementation/session_create_implementation_shared.cc:1444

@Desz01ate I've tested 2 emulators with 2 images, one with translated ABI and one with not translated ABI:

Image Image

Error appears on both images.


Dear @devbridie this issue has been open for over a year now, and chance it will get seen and fixed?

gabirat avatar Aug 27 '25 20:08 gabirat

If someone is still looking for a solution, API 33 images work for me, with Preferred ABI x86_64.

Image

gekkom avatar Nov 03 '25 00:11 gekkom