Skip to content
This repository has been archived by the owner on Sep 14, 2021. It is now read-only.

Android app crashes after splash screen with Google Play Services for AR update (after August 11th 2020) #751

Closed
ffarall opened this issue Aug 14, 2020 · 9 comments

Comments

@ffarall
Copy link

ffarall commented Aug 14, 2020

SPECIFIC ISSUE ENCOUNTERED

I'm working collaboratively on an Android app that uses AR Foundation. From one day to another (without making new builds) the app started to crash after the splash screen, every time. I'm working on my Huawei Mate 20 Pro, but my teammates use other Android phones (Samsung, Xiaomi and Motorola) and they continued to develop the app, and it works just fine for them. I pull their commits (which work for them), make no changes, and it keeps crashing on my phone. We are using Firebase so I have the info from Crashlytics:

Caused by java.lang.Error
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Version '2019.4.8f1 (60781d942082)', Build type 'Release', Scripting Backend 'mono', CPU 'armeabi-v7a'
Build fingerprint: 'HUAWEI/LYA-L29/HWLYA:10:user/release-keys' Revision: '0' ABI: 'arm'
Timestamp: 2020-08-13 14:12:37-0300 pid: 3571, tid: 3777,
name: UnityMain >>> com.app.name <<<
uid: 10315 signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference r0 00000000 r1 00000000 r2 00000000 r3 00000000 r4 a965d490 r5 bd74a87c r6 80808080 r7 00000000 r8 be98f540 r9 00000000 r10 00000000 r11 b2f15f60 ip b2f4cc90 sp bd74a878 lr b2f1e859 pc 00000000
managed backtrace: #00 (wrapper managed-to-native)
UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi:UnityARCore_session_update (UnityEngine.ScreenOrientation,UnityEngine.Vector2Int,intptr,UnityEngine.XR.ARSubsystems.Feature) #01
UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider:Update (UnityEngine.XR.ARSubsystems.XRSessionUpdateParams,UnityEngine.XR.ARSubsystems.Configuration) <0xef> #02
UnityEngine.XR.ARSubsystems.XRSessionSubsystem:Update (UnityEngine.XR.ARSubsystems.XRSessionUpdateParams) <0x1d3> #03
UnityEngine.XR.ARFoundation.ARSession:Update () <0x157> #04
(wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)

I've managed to find the C# script containing the UnityARCore_session_update function, and I checked that none of its four arguments are null. From what I could understand, after that, the script calls a function defined in UnityARCore dll, so I couldn't go any further.

I made an empty project with just an AR Session Origin and an AR Session, and I checked if it would work, but it also crashes.

I would like to remark the fact that this happened from one day to another, everything had been working perfectly on my phone for months. One day I built the app and it was ok, the other day I opened it again (no new builds or phone updates in the middle), and from there on, always crashing.

Also, I want to clarify that the Huawei phone I´m using is from Australia, I´m using it from Argentina, and it has nothing to do with the Chinese versions. It runs on Android 10 and has Google Play Services (in fact Play Services for AR are installed).

VERSIONS USED

  • Unity: 2019.4.6f1, 2019.4.8f1, 2020.1.2f1
  • ARCore SDK for Unity: ARCore XR Plugin 4.0.3
  • Device manufacturer, model, and O/S: Huawei Mate 20 Pro, Android 10 EMUI 10.1.0
  • ARCore:
    On Windows, use: adb shell pm dump com.google.ar.core | findstr /i "packages: versionName"
    On macOS, use: adb shell pm dump com.google.ar.core | egrep -i versionName\|packages:
  • Output of adb shell getprop ro.build.fingerprint:

STEPS TO REPRODUCE THE ISSUE

  1. Create a project with the packages AR Foundation and ARCore.
  2. Add AR Session Origin and AR Session to the scene.
  3. Build for Android, and specifically for Huawei Mate 20 Pro. I can´t tell if this is a general thing for other Huawei devices because I haven´t tried.
  4. Run the app and it should crash after the splash screen.

WORKAROUNDS (IF ANY)

Locate the file ARCoreSessionSubsystem inside Packages/com.unity.xr.arcore/Runtime/ and comment out lines 95 to 99, which is the function call for NativeApi.UnityARCore_session_update.

The app won't crash but the camera won't show either, so it's not really a full workaround.

@Cimera42
Copy link

Cimera42 commented Aug 14, 2020

I'm getting this exact same issue on my Samsung Galaxy A50. With a new project with just AR Session and AR Session Origin, it crashes as soon as I press the "Allow Camera" option.
The arfoundation-samples project worked a few days ago on my phone, but I re-ran it today and it crashed as well. On a hunch I looked at my app updates, and Google Play Services for AR (a.k.a. ARCore) was updated yesterday. This makes me think something changed with ARCore which is causing this issue.
image

When I run adb shell pm dump com.google.ar.core | findstr /i "packages: versionName" to get the version, I get:

Packages:
    versionName=1.19.202100503
Hidden system packages:
    versionName=0
Active APEX packages:
Inactive APEX packages:
Factory APEX packages:

@ffarall ffarall changed the title Android app crashes after splash screen ONLY on Huawei Mate 20 Pro Android app crashes after splash screen with Google Play Services for AR update (after April 11th 2020) Aug 14, 2020
@ffarall
Copy link
Author

ffarall commented Aug 14, 2020

@Cimera42 your comment was remarkably useful! I thought the problem was with my phone but in fact is a problem with the Google Play Services for AR update, like you guessed. I managed to install an older version of the app following the instructions here and the app started working again (without having to build it again or anything, I just ran it an it worked perfectly like before). I hope the people at Google notice this issue because it's quiet important.

@Cimera42
Copy link

Cimera42 commented Aug 14, 2020

I found a solution after seeing the warning on the landing page of this repo, which says:

Upcoming breaking change affecting previously published 32-bit-only apps
In August 2020, Google Play Services for AR (ARCore) will remove support for 32-bit-only ARCore-enabled apps running on 64-bit devices. Support for 32-bit apps running on 32-bit devices is unaffected.
...
32-bit-only ARCore-enabled apps that are not updated by this time may crash when attempting to start an augmented reality (AR) session.

To enable 64-bit build for Android in Unity, I did the following:

  1. Project Settings -> Player -> Android -> Other Settings -> Configuration
  2. Changed scripting backend to IL2CPP (required for ARM64)
  3. Ticked ARM64 under Target Architectures

Seems ridiculous that there is no warning or verbose error message anywhere, but exporting a new build from Unity now works on my phone.

Also do you mean August, not April in the new issue title?

@ffarall ffarall changed the title Android app crashes after splash screen with Google Play Services for AR update (after April 11th 2020) Android app crashes after splash screen with Google Play Services for AR update (after August 11th 2020) Aug 14, 2020
@ffarall
Copy link
Author

ffarall commented Aug 14, 2020

I was just looking into that same thing and it worked for me too with the latest Google Play Services for AR. I share your opinion that there should be a stronger warning.

PS: Thanks for noticing the August mistake.

@aymusbond
Copy link

aymusbond commented Aug 15, 2020

@ffarall Did @Cimera42's solution work for you?

@ffarall
Copy link
Author

ffarall commented Aug 15, 2020

@aymusbond yes, both solutions worked, going to a previous version of Google Play Services for AR as well as building for ARM64.
Here's also a stackoverflow question on how to do it.
I'd recommend doing the second solution since it's what Google wants and if you publish your app you won't be having problems with users using a 64 bit architecture.

@aymusbond
Copy link

@ffarall Thanks for the reply. The ARM64 solution worked even for me now 😁. I was really worried about why's this happening.

@rsfuller
Copy link

rsfuller commented Aug 19, 2020

Apologies for the confusion!

TLDR: The dev docs will make this more clear (in progress).

Context: We are in the middle of rolling out ARCore 1.19.0. This means that you may be using Google Play Services for AR v1.19.x (which removes support for 32-bit-only ARCore-enabled apps running on 64-bit devices), but the updated instructions for using the SDK on a 64-bit device are not yet posted on the dev guides. The solution mentioned above (also here) is precisely what you will want to do in that scenario.

Solution: If building for ARCore 1.19.0 or higher and supporting 64-bit devices:

  1. Open Build Settings > Player Settings > Other Settings
  2. Switch the Scripting Configuration to IL2CPP (from Mono).
  3. Tick ARM64 under Target Architectures.

Leaving this open until the docs clearly mention this. Thanks for the reports and attention to this issue everyone!

@rsfuller
Copy link

rsfuller commented Sep 2, 2020

The settings required to build to a 64-bit device are now documented in the Unity SDK Quickstart for Android.

Additionally, in the next SDK release, the Unity console should log a warning when the ARM64 architecture is not selected on Android.

@rsfuller rsfuller closed this as completed Sep 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants