Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question ARCore crashes on Google Play publish (Unity 2020.3)

Discussion in 'AR' started by DMDigital, Mar 25, 2022.

  1. DMDigital

    DMDigital

    Joined:
    Aug 24, 2021
    Posts:
    4

    Hi all,

    We are trying to publish an AR Unity App on Google play.
    The App is built with ARFoundation in Unity. Building an Apk and deploying it on different phones works fine.
    But when testing it on GooglePlay the App crashes, when ARCore is called.
    If Googles AR services are disabled the rest of the app works fine.
    Can anyone help us on this?

    Cheers

    Building Settings:
    It was built with unity 2020.3.12f1. (same problem with 2020.3.27f1 and 2021.2.15f1)
    ARFoundation 4.1.9
    ARCore Plugin 4.1.9
    Player:
    Graphics APIs: OpenGLES3
    Minimum API Level: API Level 27 (same problem with 29)
    Target API Level: API Level 30
    Scripting Backend: IL2CPP
    Architecture: ARMv7, ARM64 (same problem with only one of them, did not try it with x86)
    Publishing Setting: user.keystore created in Unity
    Minify: Release


    Error in Google Play

    Google in general has just this small stability problem with the app:
    Non-SDK-API | Ljava/lang/invoke/MethodHandles$Lookup;-><init>(Ljava/lang/Class;I)V


    We are not sure if that's the main problem!


    Testing with Android Studio

    Trying to find the problem we exported the project and built it on an emulator (with Google Play function) in Android Studio. The app crashes when AR starts:

    I/third_party/arcore/ar/core/android/sdk/session_create.cc: Dynamite load ok.

    I/third_party/arcore/java/com/google/vr/dynamite/client/native/dynamite_client.cc: Attempting to load native library arcore_c from package com.google.ar.core

    E/DynamiteClient: Failed to load native library [packageName=com.google.ar.core,libraryName=arcore_c] from remote package:

    java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/~~0--XzCBUC3kfga4LlXxybA==/com.google.ar.core-Ncvx28IIp7LV_m1GPVz20A==/base.apk!/lib/x86/libarcore_c.so" is 32-bit instead of 64-bit
    at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
    [...]
    at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)


    I/third_party/arcore/java/com/google/vr/dynamite/client/native/dynamite_client.cc: Dynamite::LoadNativeRemoteLibrary handle=0
    E/third_party/arcore/ar/core/android/sdk/session_create.cc: Dynamite failed to load remote library

    E/third_party/arcore/ar/core/android/sdk/session_create.cc: LoadSymbolsDynamite returning AR_ERROR_FATAL.
    E/third_party/arcore/ar/core/android/sdk/session_create.cc: LoadSymbols returning status.
    E/native: session_manager.cc:56 ArPresto::ArCore session creation failed.
    V/Unity-ARCore: OnBeforeSetConfiguration
    E/CRASH: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    E/CRASH: Version '2020.3.27f1 (e759542391ea)', Build type 'Release', Scripting Backend 'il2cpp', CPU
    'arm64-v8a'
    E/CRASH: Build fingerprint: 'google/sdk_gphone_x86_64/generic_x86_64_arm64:11/RSR1.201211.001/7027799:user/release-keys'
    [...]
    E/CRASH: Tombstone written to: /storage/emulated/0/Android/data/com.DeutschesMuseum.GREIFbAR/files/tombstone_00
    E/AndroidRuntime: FATAL EXCEPTION: Unity
    MainProcess: com.DeutschesMuseum.GREIFbAR, PID: 9182

    java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    Version '2020.3.27f1 (e759542391ea)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
    Build fingerprint: 'google/sdk_gphone_x86_64/generic_x86_64_arm64:11/RSR1.201211.001/7027799:user/release-keys'
    Revision: '0'
    ABI: 'arm64'
    [...]
     
  2. queenakki

    queenakki

    Joined:
    Nov 30, 2020
    Posts:
    1
    This might be happening because 64-bit version of apps are mandatory on the Google Play store from August 2019 & I see this problem in the backtrace:

    java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/~~0--XzCBUC3kfga4LlXxybA==/com.google.ar.core-Ncvx28IIp7LV_m1GPVz20A==/base.apk!/lib/x86/libarcore_c.so" is 32-bit instead of 64-bit

    The APK probably has both 32-bit version and 64-bit version; We just need to make sure that the 32-bit version of the shared library is not picked.

    In Android Studio,
    Open ./android /app /build.gradle and add:

    ndk {
    abiFilters "armeabi-v7a", "x86"
    }


    under

    android {
    ...
    defaultConfig {
    ...


    In Unity,

    1. Remove x86 from "Target Architectures" in Unity
    2. In build.gradle , exclude x86 in the packagingOptions
    Code (CSharp):

    packagingOptions {
    doNotStrip "*/armeabi-v7a/*.so"
    doNotStrip '*/arm64-v8a/*.so'
    exclude ('/lib/armeabi/*' + '*')
    exclude ('/lib/mips/*' + '*')
    exclude ('/lib/mips64/*' + '*')
    exclude ('/lib/x86_64/*' + '*')
    exclude ('/lib/x86/*' + '*')
    }
     
  3. DMDigital

    DMDigital

    Joined:
    Aug 24, 2021
    Posts:
    4
    Thanks for the quick response! :)
    Had the same thought, but no idea how to solve it.
    I tried both of your suggestions.

    In Android Studio
    I already had abiFilters for 'armeabi-v7a', 'arm64-v8a'
    (I did not export for x86 in Unity, should i do that?)
    With the change the emulator couldn't open the libmain.so.
    ______________

    In unity I added packagingOptions via Custom Main Gradle in the "mainTemplate.gradle":
    upload_2022-3-28_14-14-52.png

    When I uploaded it to unity it said, that a lot of phones are not supported anymore.
    On the phone, nothing changed. Same problem as before.

    Are there any ways to change the plugins in unity so they just use just the 64 version?
    or any other suggestions?
     

    Attached Files:

  4. todds_unity

    todds_unity

    Unity Technologies

    Joined:
    Aug 1, 2018
    Posts:
    324
    Ensure that you have both ARMv7 and ARM64 enabled in ProjectSettings -> Player -> Android -> Configuration.

    Additionally, you should remove the all of the abiFilters entirely because that snippet will most likely break on certain devices.
    ar-foundation-arcore-target-architectures-2022-03-28.png
     
  5. DMDigital

    DMDigital

    Joined:
    Aug 24, 2021
    Posts:
    4
    Thanks!
    But these are already my standard settings.
     
  6. todds_unity

    todds_unity

    Unity Technologies

    Joined:
    Aug 1, 2018
    Posts:
    324
    @DMDigital , would you please use "Analyze APK" in Android studio and share screenshots of BOTH your app's lib directory and ARCore's lib directory? Also, if you could share a screen shot of your AVD architecture, that would help.
     
  7. DMDigital

    DMDigital

    Joined:
    Aug 24, 2021
    Posts:
    4
    This is what I found about ARCore in "Analyze APK".
     

    Attached Files:

  8. wayhow

    wayhow

    Joined:
    Sep 12, 2019
    Posts:
    2
    "arm64-v8a/libarcore_c.so" is 64-bit instead of 32-bit means your "google play services for ar" is 64-bit ,but your app use 32-bit,so you need to update "google play services for ar"