Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
3.05k stars 1.14k forks source link

ARCore fails when building google play app bundle #96

Closed nilsk123 closed 5 years ago

nilsk123 commented 5 years ago

Hi,

When building app bundles instead of APK's arcore fails to initialize:

02-15 13:33:26.254 4002 4026 I ArPresto: ArPresto_initialize 02-15 13:33:26.255 4002 4026 E Unity-ARCore: Failed to register lifecycle provider, Camera subsystem will be unavailable! 02-15 13:33:26.255 4002 4026 E Unity-ARCore: Failed to register lifecycle provider, Depth subsystem will be unavailable! 02-15 13:33:26.255 4002 4026 E Unity-ARCore: Failed to register lifecycle provider, Plane subsystem will be unavailable! 02-15 13:33:26.255 4002 4026 E Unity-ARCore: Failed to register lifecycle provider, Raycast subsystem will be unavailable! 02-15 13:33:26.255 4002 4026 E Unity-ARCore: Failed to register lifecycle provider, ReferencePoint subsystem will be unavailable! 02-15 13:33:26.255 4002 4026 E Unity-ARCore: Failed to register lifecycle provider, Session subsystem will be unavailable! 02-15 13:33:26.255 4002 4026 E Unity-ARCore: Failed to register lifecycle provider, Input subsystem will be unavailable!

Screen stays black, no camera permissions asked:

ARFoundation 1.0.0-preview.22 ARCore XR Plugin 1.0.0-preview.24 ARKit XR Plugin 1.0.0-preview.23

AsynchronySuperWes commented 5 years ago

Same issue here. 03-12 17:16:26.707 18908-18999/com.unity.arfoundation.samples E/Unity-ARCore: Failed to register lifecycle provider, Camera subsystem will be unavailable! Failed to register lifecycle provider, Depth subsystem will be unavailable! Failed to register lifecycle provider, Plane subsystem will be unavailable! Failed to register lifecycle provider, Raycast subsystem will be unavailable! Failed to register lifecycle provider, ReferencePoint subsystem will be unavailable! Failed to register lifecycle provider, Session subsystem will be unavailable! Failed to register lifecycle provider, Input subsystem will be unavailable!

The sample works fine on iOS.

Tyxop commented 5 years ago

I have same problem, with Unity 2019.1.5 + Arcore 2.1.0 preview 5 - Arfoundation 2.1.0 Preview. 5, I do not know how to fix it and I need to upload my application to the store. Any idea how it could be compiled?

derwaldgeist commented 5 years ago

Same problem here on a Moto G5Plus

dorkbot commented 5 years ago

Seeing same issue.

tdmowrer commented 5 years ago

I've identified an issue with app bundles on Android and have a fix pending. You can track the issue here.

derwaldgeist commented 5 years ago

I have the same issue, but on some devices (Moto G5 Plus, Samsung S8), it also occurs for regular APKs. But only if I deploy the app via Android Studio or the Goolge Play Store. If I run it directly from within Unity (build & run), it works.

tdmowrer commented 5 years ago

I have the same issue, but on some devices (Moto G5 Plus, Samsung S8), it also occurs for regular APKs. But only if I deploy the app via Android Studio or the Goolge Play Store. If I run it directly from within Unity (build & run), it works.

It has to do with "split APKs", which is something you can enable in Android Studio, and also kicks in when building an app bundle from within Unity. The file system within Unity behaves differently in this case, and may or may not find some data which affects input tracking.

derwaldgeist commented 5 years ago

@tdmowrer I can confirm that the App works, if I disable Instant Run in Android Studio.

But how does this explain that the problem also appears if I create APKs from within Unity, deploy these to the app store, and then download the app from Google Play? I am not using app bundles for this.

However, I have enabled APK platform splitting in Unity, because only with this option my app can be kept below 100 MB for each platform (arm-v7, arm-64, x86). Or does this splitting impact ARCore as well? If so, this is a blocker for me, as AR apps tend to get become big.

tdmowrer commented 5 years ago

However, I have enabled APK platform splitting in Unity

For the same reason, I would not expect this to work. Splitting the APK does not work with the ARCore XR Plugin. There are a number of ways to do this -- "Split Application Binary", App Bundles, or as an option from Android Studio.

derwaldgeist commented 5 years ago

Thanks for the fast response. Do you mean "split APK by target architecture" or "split APK into APK and OBB"? If neither are possible, this was really a bummer. AR apps tend to become quite huge, due to the content involved. So I have to split them somehow. And is there any chance these splitting problems get resolved soon?

nilsk123 commented 5 years ago

Split apk by architecture works just fine for me, app bundles do not

tdmowrer commented 5 years ago

Do you mean "split APK by target architecture" or "split APK into APK and OBB"?

I would expected "split APK by target architecture" to still work. Sounds like it does for @nilsk123 .

And is there any chance these splitting problems get resolved soon?

I have a fix working its way through our release process. Track it here.

derwaldgeist commented 5 years ago

I would expected "split APK by target architecture" to still work. Sounds like it does for @nilsk123 .

Yes, I can confirm this now. It works.

I have a fix working its way through our release process.

Awesome, sounds good. Thanks for the fast response. I guess this will be backported to 2018.x LTS at least?

tdmowrer commented 5 years ago

I guess this will be backported to 2018.x LTS at least?

This is considered a bug fix, so yes it will be backported to 2018.4, 2019.1*, and 2019.2.

* The 2019.1 backport depends on how quickly I can get the fix in, as no more bug fixes will go into 2019.1 after 2019.2 is released.

derwaldgeist commented 5 years ago

Sounds awesome! And superfast, as always :-)

dorkbot commented 5 years ago

Do you mean "split APK by target architecture" or "split APK into APK and OBB"?

I would expected "split APK by target architecture" to still work. Sounds like it does for @nilsk123 .

And is there any chance these splitting problems get resolved soon?

I have a fix working its way through our release process. Track it here.

Just to be clear, "split APK by target architecture" is done by selecting "Split Application Binary" in the publish settings for Android, correct?

I have "Split Application Binary" selected, my project is successfully performing a "Build And Run" to my device and the app works.

derwaldgeist commented 5 years ago

Just to be clear, "split APK by target architecture" is done by selecting "Split Application Binary" in the publish settings for Android, correct?

No, the option is below the target architecture settings (arm-v7 etc.)

I have "Split Application Binary" selected

This will work if you run the app from Unity, but not if you load the app from Google Play.

tdmowrer commented 5 years ago

Documentation:

dorkbot commented 5 years ago

Our app has been approved in the app store https://apps.apple.com/us/app/crispr-3d/id1468426395?ls=1

But still haven't had any luck getting Google Play approval. I am using Split Application Binary, and not split APK by target architecture. The pre-launch report shows a screen capture video of the app crashing on a sony device after ARCore is updated and the report dinged us for one crash (but my understanding is that the Google Play Store is suppose to install ARCore before installing our app. I have ARCore set to required. Google Play hasn't rejected this app yet, it's our third attempt, but there are warnings. Has anyone had any luck getting a ARFoundation app in the Google Play store? Ours uses planar and image tracking.

tdmowrer commented 5 years ago

@dorkbot

I am using Split Application Binary, and not split APK by target architecture.

The "Split Application Binary" currently breaks ARFoundation. A fix is on the way.

The pre-launch report shows a screen capture video of the app crashing on a sony device after ARCore is updated and the report dinged us for one crash (but my understanding is that the Google Play Store is suppose to install ARCore before installing our app.

The issue discussed in this thread should not cause a crash (you just won't have pose tracking). Do you have any additional information concerning the crash, like a callstack?

dorkbot commented 5 years ago

Oops, I reversed that. What I mean is, I'm using "Split APK by target architecture" and NOT using "Split Application Binary".

dorkbot commented 5 years ago

Google Play's test shows our app crashing on a Xperia XZ1 Compact.

Here is the Logcat output -> logcat.txt

dorkbot commented 5 years ago

Google play's rejection email said that the 30000 APK wont install. What I did -> I used "Split APK by target architecture" with ARMv7, ARM64 and x86 selected. When I upload these APKs into the Google Play Console, they are given Version names 10000, 20000 and 30000. So I'm not sure which is what, again 30000 wont install. When I copy the APKs to my Pixel 3, the one for x86 wont install. So I assume this one is the issue, and I think that makes sense, my phone wouldn't support an app made for that ach, right? So any advise? Should I just not add x86 to the Google play store? The other issue is that the 20000 version is crashing on the Xperia, which I can't recreate on any of our Android devices.

tdmowrer commented 5 years ago

Google play's rejection email said that the 30000 APK wont install. What I did -> I used "Split APK by target architecture" with ARMv7, ARM64 and x86 selected. When I upload these APKs into the Google Play Console, they are given Version names 10000, 20000 and 30000. So I'm not sure which is what, again 30000 wont install. When I copy the APKs to my Pixel 3, the one for x86 wont install. So I assume this one is the issue, and I think that makes sense, my phone wouldn't support an app made for that ach, right? So any advise? Should I just not add x86 to the Google play store? The other issue is that the 20000 version is crashing on the Xperia, which I can't recreate on any of our Android devices.

x86 is supported; not sure why it wouldn't install.

The crash appears to be here:

06-18 21:33:34.921: I/native(17163): arpresto_api.cc:132 ArPresto::ArPresto_setEnabled
06-18 21:33:34.921: I/native(17163): arpresto_api.cc:176 ArPresto::ArPresto_reset
06-18 21:33:34.921: I/native(17163): arpresto_api.cc:120 ArPresto::ArPresto_setCameraTextureName
06-18 21:33:34.923: I/native(17163): arpresto_api.cc:198 ArPresto::ArPrestoAugmentedImageDatabase_destroy
06-18 21:33:34.923: E/CRASH(17163): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000000000000000
06-18 21:33:34.923: E/CRASH(17163): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-18 21:33:34.923: E/CRASH(17163): Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
06-18 21:33:34.923: E/CRASH(17163): Build fingerprint: 'Sony/G8441/G8441:8.0.0/47.1.A.12.205/2573353275:user/release-keys'
06-18 21:33:34.923: E/CRASH(17163): Revision: '0'
06-18 21:33:34.923: E/CRASH(17163): pid: 17163, tid: 17191, name: UnityMain  >>> org.innovativegenomics.CRISPR_3D <<<
06-18 21:33:34.923: E/CRASH(17163):     x0   0000000000000000  x1   0000000000000000  x2   0000007612400000  x3   0000000000000008
06-18 21:33:34.923: E/CRASH(17163):     x4   00000000000001ae  x5   000000762401a166  x6   6f74736572707261  x7   3a63632e6970615f
06-18 21:33:34.923: E/CRASH(17163):     x8   00000076160e2060  x9   0000000000000001  x10  0000000000000000  x11  0000000000000000
06-18 21:33:34.923: E/CRASH(17163):     x12  617461446567616d  x13  7365645f65736162  x14  ffffffffffffffff  x15  000083d97569d2a5
06-18 21:33:34.923: E/CRASH(17163):     x16  00000076115d1040  x17  00000076160c6774  x18  0000000000000012  x19  00000076116e83a0
06-18 21:33:34.923: E/CRASH(17163):     x20  000000762401a778  x21  0000000000000000  x22  000000761609f5e0  x23  000000761609f6a0
06-18 21:33:34.923: E/CRASH(17163):     x24  0000000000000000  x25  0000000000000000  x26  0000000000000001  x27  0000000070d8c128
06-18 21:33:34.923: E/CRASH(17163):     x28  0000000000000000  x29  000000762401a8f0  x30  0000007611550e80
06-18 21:33:34.924: E/CRASH(17163):     sp   000000762401a6f0  pc   0000000000000000  pstate 0000000060000000
06-18 21:33:34.924: E/CRASH(17163): backtrace:

I've never seen that; ArPresto is a Google API; I'm not sure what would cause that. Are you able to reproduce locally?

dorkbot commented 5 years ago

No, I can't not reproduce it locally. However, I have a correction. All APKs did install during Google Play's test. The crash was from the Xperia installing ARCore while our app was running, however my understanding is that the Google Play store first installs ARCore before installing a ARCore app. And the other correction is that our app didn't get rejected for this, it was rejected for a metadata issue related to age targeting, nothing to do with the app it's self. The logcat I sent you was for the Xperia crashing. So I think this is a non issue. I will report back. Thank you for your time.

tdmowrer commented 5 years ago

The crash was from the Xperia installing ARCore while our app was running, however my understanding is that the Google Play store first installs ARCore before installing a ARCore app.

It depends. The Play store installs ARCore along with apps marked as "ARCore required". If you're using "ARCore optional", then it is installed on demand (the user gets a prompt asking them to install it in the app). See these docs.

dorkbot commented 5 years ago

I have ARCore set to Required, and from what I understand, Google Play will therefore only allow ARCore supported devices to download the app and will install ARCore before installing the app. So any crash caused by installing ARCore during testing (side loading an app) can not happen when the app is downloaded via Google Play.

"AR Required means that your app is not usable without AR. The Play Store ensures that AR Required apps are only made available to devices that support ARCore. When users install an AR Required app, the Play Store automatically installs ARCore before installing the app." https://developers.google.com/ar/develop/unity/enable-arcore

dorkbot commented 5 years ago

So an app finally got approved for testing in Google Play, you can see it here -> https://play.google.com/store/apps/details?id=org.innovativegenomics.CRISPR_3D&rdid=org.innovativegenomics.CRISPR_3D

But on my Pixel 3 it's not working, it goes black when I get to the AR part of the app. When I side load it the app works perfectly, but when I download it via the store it doesn't work. Does anyone have any suggestions?

dorkbot commented 5 years ago

The testing video shows that the app is crashing on a Pixel 3 when it installs ARCore (which I don't think is a use case that is suppose to happen). And I test on a Pixel 3 everyday and never have this issue when performing a build from Unity.

dorkbot commented 5 years ago

You guys are welcome to join our test, please do -> https://play.google.com/apps/testing/org.innovativegenomics.CRISPR_3D

tdmowrer commented 5 years ago

Update: The fix for 2019.3 will be in 2019.3 alpha 8. This is the first step. Backports to 2018.4, 2019.1, & 2019.2 are still pending.

tdmowrer commented 5 years ago

The fix has made it to these released versions of Unity: 2018.4.4f1, 2019.1.10f1, 2019.2.0b9, & 2019.3.0a8

msNEOANALOG commented 2 years ago

We have the same problem (see here) but since 2021 we need to upload AABs to the Google Play Store and our app would be too big if it was split by architecture anyway. Do you have any idea how we could solve that problem? We are on Unity 2021.2.8 and AR Foundation 4.2.2.