Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
3.02k stars 1.12k forks source link

ARFoundation not working on split Android App Bundle #941

Closed msNEOANALOG closed 2 years ago

msNEOANALOG commented 2 years ago

Hey all, when we try to test our AR App using AR Foundation on Android via the Google Play Console it just does not work. The AR Content does not move relative to the camera. The app is bigger then 150MB so we have Player Settings>Publishing Settings>Split Application Binary = on. And we have to build as Android App Bundle for the Play Store. It works perfectly without splitting build&run on device. We saw this article where splitting by architecture seems to solve the problem. But since Google updated the rules, we have to upload an AAB. Not several APKs. We're stuck. Any ideas? Thanks!

ankur-unity commented 2 years ago

Split Application Binary does not split an Android app into APK and AAB (asset bundle). It creates APK and OBB files. To create an AAB file, use "Build App Bundle (Google Play)" option in the Build Settings > Android. https://docs.unity3d.com/Manual/android-BuildProcess.html

msNEOANALOG commented 2 years ago

Split Application Binary does not split an Android app into APK and AAB (asset bundle). It creates APK and OBB files. To create an AAB file, use "Build App Bundle (Google Play)" option in the Build Settings > Android. https://docs.unity3d.com/Manual/android-BuildProcess.html

Thanks ankur-unity. We are doing that. The problem is that ARFoundation does not work when the AAB is installed via Play Console. It shows no errors and initializes normally but the rotation and position of the camera is fixed.

ankur-unity commented 2 years ago

Thanks ankur-unity. We are doing that. The problem is that ARFoundation does not work when the AAB is installed via Play Console. It shows no errors and initializes normally but the rotation and position of the camera is fixed.

You mentioned in your original post that:

we have Player Settings>Publishing Settings>Split Application Binary = on

This will create an OBB file. You will need to turn that off to avoid this. You only need to check the option "Build Settings > Android > Build App Bundle (Google Play)" to create an AAB file.

msNEOANALOG commented 2 years ago

Dear ankur-unity. Thanks for the reply. The thing is, that we have to split the AAB because it is bigger than 150MB and Google Play Console will not accept that. As soon as we split it, AR Foundation stops working properly.

We were not able to figure that out and are now moving to external addressables to make the app smaller and deploy it without splitting.

Weimmer commented 2 years ago

Hi I think I have same issue as yours. When build the apk from unity, it works fine, but once I build the aab file and upload to google play console, it will generate a apk file, but the apk does not work, when the ar session active is, the app crashed...

Weimmer commented 2 years ago

PLS let me know if you find any resolution for that... I will try my best to solve it, if I figur it out, I will come here to you same.

msNEOANALOG commented 2 years ago

Hi I think I have same issue as yours. When build the apk from unity, it works fine, but once I build the aab file and upload to google play console, it will generate a apk file, but the apk does not work, when the ar session active is, the app crashed...

We do not have problems with AABs per se. Only when they are split. No matter if we build&run a split AAB directly to device or via Play Console.

Weimmer commented 2 years ago

Hi I think I have same issue as yours. When build the apk from unity, it works fine, but once I build the aab file and upload to google play console, it will generate a apk file, but the apk does not work, when the ar session active is, the app crashed...

We do not have problems with AABs per se. Only when they are split. No matter if we build&run a split AAB directly to device or via Play Console.

ok... you app works fine when they are not split? my issue happens when I turn on the ar session... using the unity 2021.2.13 and ar foundation 4.2.2

msNEOANALOG commented 2 years ago

you app works fine when they are not split?

Yes.

Weimmer commented 2 years ago

you app works fine when they are not split?

Yes.

how do you know that... you can not upload the aab file bigger than 150 MB and that is the reason why you split it. I mean my app works fine when it not uploaded.

msNEOANALOG commented 2 years ago

how do you know that... you can not upload the aab file bigger than 150 MB and that is the reason why you split it. I mean my app works fine when it not uploaded.

I tried it with the ARFroundation example from Unity. It is split, but small. Didn't work. The scene is fixed to the camera.

Weimmer commented 2 years ago

how do you know that... you can not upload the aab file bigger than 150 MB and that is the reason why you split it. I mean my app works fine when it not uploaded.

I tried it with the ARFroundation example from Unity. It is split, but small. Didn't work. The scene is fixed to the camera.

So you mean the ar-foundation exsample aab file can be uploaded, and the apk from google play console works even the ar-foundation exsample was not splited

Weimmer commented 2 years ago

because I even tried with blank scene, only ar session and ar session origin, it crashed same...

msNEOANALOG commented 2 years ago

So you mean the ar-foundation exsample aab file can be uploaded, and the apk from google play console works even the ar-foundation exsample was not splited

It works as long as it is not splitted. Wether it's an APK or an AAB.

pacolaf commented 2 years ago

Same here, with Unity 2021.2.15f1 (macOS). The app runs perfectly in my connected Android device if the split apk option is not selected. But my app is large and it requires to be splitted for release in Google Play. After the split apk option is selected, the app is installed in the device with no errors but the camera tracking doesn't work, the camera is fixed.

The problem occurs in both apk and aab publish options. I also have tried the Google Asset Delivery plugin for Unity with the same result: with Separate APK Base Asset option active fails (camera is fixed) and with this option disabled it works in my device but I cannot publish de aab file because of its size.

This problem doesn't occur with Unity 2021.1.20, my previous version of Unity before updating to 2021.2.X.

iOS (ARKit) version of my app works perfectly.

ankur-unity commented 2 years ago

This is a known issue. As noted in this thread, the issue only occurs when the app is compiled with "Split Binary" option. The issue occurs because the UnitySubsystemsManifest.json file that's required for AR Input Subsystem always exist in the main APK while it's being searched in the obb at runtime, if the app was compiled with split binary mode.

The progress on a fix can be tracked here: https://issuetracker.unity3d.com/issues/android-xr-tracking-is-not-working-when-building-app-bundle-with-split-application-binary-enabled

pacolaf commented 2 years ago

This is a known issue. As noted in this thread, the issue only occurs when the app is compiled with "Split Binary" option. The issue occurs because the UnitySubsystemsManifest.json file that's required for AR Input Subsystem always exist in the main APK while it's being searched in the obb at runtime, if the app was compiled with split binary mode.

The progress on a fix can be tracked here: https://issuetracker.unity3d.com/issues/android-xr-tracking-is-not-working-when-building-app-bundle-with-split-application-binary-enabled

Thanks for the information! I just installed version 2021.2.4f1 and it works. I will keep on using this version until the issue is fixed.

pacolaf commented 2 years ago

This issue is finally fixed in 2021.3.2f1. I have tested it and it works fine.

ankur-unity commented 2 years ago

The issue has been fixed in 2021.3.2f1, 2022.2.0a9, and 2022.2.1f1