I hope this finds you well.
I am using unity 2021.3.3f1 (gradle 6.1 installed with unity, target android 11, apis 30) and ADRK example. When i deploy on my samsung galaxy 10 note+ (Android 11) a prompt asks to install google ar core services, but i already have installed it. The result is that stucks I can’t build anything…using ARCore.
I followed this Building ARDK Apps for Android — Niantic Lightship Augmented Reality Developer Kit release-2.0 documentation without success. I am wondering if you’ve figured out the problem. Thanks in advance for any suggestions and tips.
Very best Chiara
The documentation seems to be not really complete for the " Building for Android 11 (API level 30) and higher" section yet. Tried a lot, but still not running…
So, easiest workaround at the moment, to bring it to work on all devices is just setting Minimum target Level to Android 7.0 Nougat (API level 24) and Target API Level to Android 10.0 (API level 29)
Add a Custom Main Manifest to your Unity project
- Select Edit > Project Settings… > Player
- Scroll to the bottom of the Player settings window, and expand the Publishing Settings section
- Under Build, check the box next to Custom Main Manifest
Add the needed tag to your Custom Main Manifest
- Open the AndroidManifest.xml file located at <project_root>/Assets/Plugins/Android in the text editor or IDE of your choice
- Add the following tag to the end of the file, just before the closing manifest tag:
<queries> <package android:name="com.google.ar.core" /> </queries>
Then save the file, and try building again. Your AndroidManifest.xml file should look similar to this when you’re done:
Please let me know if this works. If there’s another issue that you are running into it would be great if we could identify what that may be.
@BBIT-Solutions I agree that our documentation for Building for Android 11 (API level 30) and higher does need some clarification. Have you tried the steps from the post above from @Moranda_Nalls1 ? To my knowledge, we don’t mention the Custom Main Manifest setting in our docs, and I think that this is where a lot of the confusion stems from.
Thanks all for the replies,
yes I inserted a custom AndroidManifest.xml with the arcore query, but it doesn’t solve the problem. Ok, now i am no longer receive the message to install arcore on my device (already installed) but when i open a scene ex: ping-pong or context awarness, don’t start any AR, no camera AR permission? How to fix? Thanks in advance
@David_Quevedo Yes, i used the section for the Building in the documentation as a base (what is actually same like in the post above), but then got different errors. I solved them then step by step with adding (and editing) different custom gradles (base, main, launcher…) as well as combine it with different gradle versions and also later tried to combine it with the ARCore plugin provider, etc.
But each combination brings new problems and nothing worked so far unfortunatelly.
Only workaround, which at least always works, is just to build for Android 10 instead, without any changes in the Manifest or gradle…
No… if i remove the custom launcher manifest with the query, i got stuck on trying to install google ar core service (i already have). Same if i target android 10. So ,I can’t use Niantic, it’s a pity.
very best, Chiara
You also get the popup on your device, when you target android 10?
Do you get any warnings during the build or any errors or so in the LogCat when running on your Device?
Also can you ensure, that all files (Manifest and gradle stuff) in Assets/Plugins/Android are deleted? Because if you only uncheck it in the PlayerSettings, the actual files are sometimes not deleted
When i target android 10 is the same as 11. No ar camera. Yes, I deleted the custom manifest when targeted 10. The strangeitude is that there are no errors on my device in the logcat… I am starting to think maybe there are some issues with camera permissions?
Or maybe my galaxy 10 note plus? But is it in the list and arcore is installed.
Permissions could be a problem. But then it should actually only stay black, and not showing the arcore-install-request-popup…
To be sure, you could try using the AndroidPermissionRequester component, add the camera permission there and check the Request On Update checkbox, to be sure.
Hi, i just find a solution that work for me,
- using unity 2020.3.19f
- tested on Huawei P30
1- first you have to do this :
2- then in the AndroidManifest.xml , you should find permissions like that :
uses-permission android:name=“android.permission.INTERNET” /
uses-permission android:name=“android.permission.ACCESS_NETWORK_STATE” /
uses-permission android:name=“android.permission.ACCESS_FINE_LOCATION” /
you have to add a permission for camera, so just add this line below the queries section :
< uses-permission android:name=“android.permission.CAMERA” / >
and make sur to have the “Android Permission Request” Script with the same gameobject of the “AR Session Manager”
3- Build, run the app, authorise the camera, not working, close the app, open the app, working for me
- let me know if this work for you
Thanks for the reply.
I put an Android Permission Request script (with camera) attached to the arscenemanager. Is it ok? Or do I need to attach it to ARSceneCamera? Then I insert the query in the launcher custom but I get the errors listed in the screens i took for you to see. I got something wrong for sure…
I guess it doesn’t care on which GameObject you put it (as long as it is an active one in the scene), because it’s an extra component. But i also have it on ARSceneManager, so that should work.
Your error is probably, because your uses-permission is inside the queries tag. It should be on the same “layer” in the xml-hierarchy like the application tag.
Hi Chiara, add the Android Permissions Requester (Script) to your Session Manager. Set size to 1, and make sure the Camera is in the drop down. Our Basic Placement tutorial has a good example to assist you.
Also, make sure the uses-permissions line is added before after </queries. It should be written as without the space between (/>). More information can be found in our Permissions documentation.
Super thanks @Moranda_Nalls1 and all of you you make my day! I understood the mistake concerning the space / > and now i can follow your interesting tutorials.
Very best, Chiara
may be interesting to publish the list of Android permissions AndroidManifest.xml - platform/packages/apps/Camera - Git at Google
I usually use ARkit for IOS and it is all included, permissions too. I didn’t know Android needed permissions in a custom manifest.
Thanks to you, I’ve also fixed another Android AR App I developed a while ago using ARFoundation with ARCore.
https://play.google.com/stor/apps/details?id=com.chiarapassa.stilllifeChiara that, of course, needed camera permission in the manifest.
Sending my best, Chiara
Hi Chiara, glad you were able to get up and running. Good luck on your journey.