google-ar / arcore-android-sdk

ARCore SDK for Android Studio
https://developers.google.com/ar
Other
4.95k stars 1.22k forks source link

Error with instant app on Store #1325

Open caiocs opened 2 years ago

caiocs commented 2 years ago

Hello,

I'm generating a instant app with AR Core to the store, When I'm using the Android Studio and run the Instant App, Everything works and I'm able to generate a Session. But when I send this instant app to the store, and click on the "try now" button. I get a error when trying create a session. If I install the app, everything works, this problem only happens with the Android 11 and when I'm trying to run the Instant app from the Store. Any thoughts?

Error:

2021-12-08 11:30:12.126 25278-25278/? E/DynamiteClient: Failed to load native library [packageName=com.google.ar.core,libraryName=arcore_c] from remote package:

java.lang.IllegalStateException: Library arcore_c loaded in the same classloader context as library null
    at com.google.vr.dynamite.NativeLibraryLoader.initializeAndLoadNativeLibrary(PG:1)
    at fxw.A(PG:6)
    at ago.onTransact(PG:3)
    at android.os.Binder.transact(Binder.java:1054)
    at com.google.ar.core.dependencies.d.b(BaseProxy.java:2)
    at com.google.vr.dynamite.client.b.initializeAndLoadNativeLibrary(INativeLibraryLoader.java:3)
    at com.google.vr.dynamite.client.DynamiteClient.loadNativeRemoteLibrary(DynamiteClient.java:8)
    at com.google.ar.core.Session.nativeCreateSessionAndWrapperWithFeatures(Native Method)
    at com.google.ar.core.Session.<init>(Session.java:11)
    at com.google.ar.core.Session.<init>(Session.java:4)
    at com.google.ar.sceneform.ux.BaseArFragment.onCreateSession(BaseArFragment.java:505)
    at com.google.ar.sceneform.ux.BaseArFragment.initializeSession(BaseArFragment.java:468)
    at com.google.ar.sceneform.ux.BaseArFragment.onResume(BaseArFragment.java:248)
    at androidx.fragment.app.Fragment.performResume(Fragment.java:3039)
    at androidx.fragment.app.FragmentStateManager.resume(FragmentStateManager.java:607)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:306)
    at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
    at androidx.fragment.app.FragmentManager.dispatchResume(FragmentManager.java:3086)
    at androidx.fragment.app.FragmentController.dispatchResume(FragmentController.java:273)
    at androidx.fragment.app.FragmentActivity.onResumeFragments(FragmentActivity.java:458)
    at androidx.fragment.app.FragmentActivity.onPostResume(FragmentActivity.java:447)
    at androidx.appcompat.app.AppCompatActivity.onPostResume(AppCompatActivity.java:240)
    at android.app.Activity.performResume(Activity.java:8166)
    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4626)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4668)
    at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2251)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:233)
    at android.app.ActivityThread.main(ActivityThread.java:8068)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)

VERSIONS USED

STEPS TO REPRODUCE THE ISSUE

  1. Send build to Play Store and click on the "Try Now" button.
AntonClaesson commented 1 year ago

Seems as ARCore fails to initialize on some devices when running instant app, I have the same problem on a samsung device running Android 12 but not on a Xiaomi running Android 11

Michele-Telesca commented 1 year ago

We have the same problem on some devices. Has any idea or solution been found?

dodorian92 commented 1 year ago

I am having this problem with several devices. The device supports Arcore and the app works completely correctly. If I start the instant app directly from Android Studio I have no problem. Once the app is published I get a black screen and the message "failed to create ar session".

The problem occurred on:

vTimePhil commented 1 year ago

anyone found anything more on this? Im using SceneView but have the same issue

vTimePhil commented 1 year ago

Not to keep bumping this but I did notice on OnePlus IN2013 Android 11, API 30 Im getting similar but this could be the culprit:

Failed to load native library [packageName=[com.google.ar](http://com.google.ar/).core,libraryName=arcore_c] from remote package:
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/~~8RT7nEe_S0X111Yc2DsbDQ==/com.google.ar.core-hNr0z_Ue1j5GoskItU98Dg==/base.apk!/lib/arm64-v8a/libarcore_c.so" is 64-bit instead of 32-bit
vTimePhil commented 1 year ago

just incase anyone is searching why some devices are giving a black output for camera while using Instant variant I solved my issue by adding the following to my gradle file:

ndk { abiFilters.add("arm64-v8a") }

dodorian92 commented 1 year ago

@vtime-phil can you tell us how this solved your problem? I tried but I still get the same error. Is there any news or updates on this?

vTimePhil commented 1 year ago

@vtime-phil can you tell us how this solved your problem? I tried but I still get the same error. Is there any news or updates on this?

Apologies @dodorian92 I was rather premature in my celebration. It seems that by putting that filter it knocked off my Pixel and Huawei, reverting put my back to square one. I tried removing all (default) and again back to square one. I currently have a ticket on issue tracker too:

https://issuetracker.google.com/issues/278743538

Still no joy as such

PriteshNikam commented 1 year ago

I am encountering same issue while trying to run an instant app which I have uploaded to the play store that utilizes AR Core functionality. The error message displayed in log is as follows: "Failed to load native library [packageName=com.google.ar.core, libraryName=arcore_c] from remote package." As several developers have already raised this issue but it still remains unresolved. I would greatly appreciate an update on the progress of this issue.

Steps to Reproduce:

  1. Try the instant app from the Google Play Store which has AR core functionality.
  2. Launch the app and trigger AR Core functionality.
  3. Observe the error message: "Failed to load native library [packageName=com.google.ar.core, libraryName=arcore_c] from remote package." Expected Behaviour: The AR Core native library should load successfully within the instant app, allowing the AR functionality to function as intended.

Additional Information:

I have tested this on some devices and results are as below -

Device: Successful to load AR core library: Xiaomi K20 pro, Pixel 3. Failed to load AR core library: Samsung (S8, S9, S10, S21 FE, note 10+), Nothing, Oneplus 7t.

ovivoda commented 1 year ago

Any news on this issue? I am facing the same problem.

Spaarkly1 commented 1 year ago

HI. I tried to access the issue for any updates on the problem. Unfortunately by opening the link I get access denied. I think the only solution to get an answer to this problem is to continue reporting as there is nothing we can do. The problem affects most of the samsung then a wide range of devices.

vTimeTom commented 11 months ago

This problem appears to be caused by ABI splitting resulting in problems on certain phones.

I've had success getting rid of this problem by disabling ABI splitting in the main app's build.gradle, e.g:

android{  
    bundle {  
        abi {  
            enableSplit = false  
        }  
    }  
}  

This page is what led me to trying this solution, but since ABI splitting is probably desirable it's only really a workaround - and probably only suitable for testing builds rather than deploying to production.

caiocs commented 11 months ago

This problem appears to be caused by ABI splitting resulting in problems on certain phones.

I've had success getting rid of this problem by disabling ABI splitting in the main app's build.gradle, e.g:

android{  
    bundle {  
        abi {  
            enableSplit = false  
        }  
    }  
}  

This page is what led me to trying this solution, but since ABI splitting is probably desirable it's only really a workaround - and probably only suitable for testing builds rather than deploying to production.

This fixed the issue!

Thanks @vTimePhil !!!!

Chunkdafunk commented 11 months ago

Cheers but you've got @vTimeTom to thank for that discovery!

PriteshNikam commented 6 months ago

This resolved my issue. Thank you, @vTimeTom! However, what if I intend to deploy the application on the Google Play Store? Disabling ABI split is not considered best practice in this scenario.

vTimeTom commented 4 months ago

Unfortunately I don't have a good answer for you there @PriteshNikam - as I said in my original comment:

since ABI splitting is probably desirable it's only really a workaround - and probably only suitable for testing builds rather than deploying to production.

Perhaps there's some additional gradle configuration that can be done in order to control the ABI splitting process properly, but I haven't looked into that side of things!