Get black background on android build

Include the following details (edit as applicable):

  • Issue category: Semantic Segmentation / Multiplayer / Real-time Mapping-Depth / ARDK Documentation / Unity Example Package / Sample App aka ‘AR Voyage’ / ARDK Virtual Studio Tools / Developer Tools / Networking / VPS
  • Device type & OS version: Android / iOS / Other Ex. iPhone 8+ on iOS 13
  • Host machine & OS version: Mac / Windows / Linux / Other Ex. Mac on Big Sur x.x
  • Issue Environment : Unity Remote / Unity Mock / On Device / Dev Portal
  • Xcode version:
  • ARDK version:
  • Unity version:

Description of the issue:
i got the adrk set up and built but when it gets to the test phone it just has a black background on the camera and doesn’t do anything else. i can see my added stuff and that works but no ar stuff works.

Hi @kyle_smith,

Did you add the below lines to your AndroidManifest.xml file?

    <package android:name="" />

If not, I guess it could be the reason.

Please check this document, and it contains how to edit the AndroidManifest.xml. Also please verify build settings as well.

Hey Kyle,

In order to help you I am going to need to collect some information from you. Please tell me the following:

  1. What is your Device type and the OS on it?
  2. What version of ARDK are you using?
  3. What version of Unity are you using?

Please get back to us as soon as you can.

yes i have done that along with all the stuff in the getting started documentation.

do you need anything else?

Hello Kyle,

Thanks for getting back to us. So I have another question or two.

  1. When you were going through your setup, did you put the camera on the correct layer?
  2. Did you remove the Vulkan graphics API? If not, I can show you how to do that.
  3. Did you add the Android Permission Requester component to your camera? You can see how to add it here: camera-permissions-for-android

Give these a try and please let us know how it goes so we can continue to troubleshoot your build.

see quote above

Hello Kyle,
I found some more information that should possibly help with your black screen issue.

You need to add AndroidPermissionRequester to your scene on the main camera as a component. Then change the permissions to 1 and make sure Element 0 is set to Camera.

Now for any of this to work you will need to make sure you have the proper manager’s placed into your scene. Usually we suggest you place them as components on the main camera. At a bare minimum for your scene to work I would suggest that you have these four manager’s added to your main camera in your scene when developing for Android: AndroidPermissionRequester,
ARSessionManager, ARCameraPositionHelper, and the ARRenderingManager. You can find them by pressing Add component on your main camera then doing a search for each one. Please let me know if this is unclear and I will go into greater detail.

made those corrections and it still requests permission but still black screen after that. this is the ar camera component in unity, in case im missing something.

Hello Kyle,

So we have a couple more suggestions we would like you to try:

  1. When was the last time you restarted your Unity editor? Sometimes after we make major changes to the scene it is a good idea to save, and when possible, restart the unity editor. This helps to clear out the errors that get stored in our cache memory.

  2. Also we noticed that you do not have ‘Manage using Unity Lifecycle’ Checked in your AR Session Manager. This could possibly cause your scene to not terminate properly, causing a black screen error. I will continue to try and help you troubleshoot your scene.

  3. Another suggestion we would make would be to try going through some of the early tutorials presented in the documentation. There may be a step that you are skipping that can be found in the tutorials.

Please let us know if any of these suggestions help. We will continue to do our best to help you figure out this issue.

i have the same problem and when i build i get these errors…
I followed everything to the tee…
I am running Unity on windows 10…could that be the issue?

Error 1
File C:\Users\\repositories.cfg could not be loaded.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Error 2
Exception: Failed running C:\Program Files\Unity\Hub\Editor\2020.3.20f1\Editor\Data\il2cpp\build/deploy/netcoreapp3.1/UnityLinker.exe @“C:/Users/winst/Downloads/XR202 - Augmented Reality/Lightship_BallDemo/Temp/StagingArea/assets/bin/Data/Managed/response.rsp”

ERROR: Failed to resolve base type System.Object for type System.Runtime.CompilerServices.Unsafe in assembly Niantic.System.Runtime.CompilerServices.Unsafe.dll when linking against the UnityAot profile
Fatal error in Unity CIL Linker
Unity.Linker.StrippingResolutionBaseTypeException: ERROR: Failed to resolve base type System.Object for type System.Runtime.CompilerServices.Unsafe in assembly Niantic.System.Runtime.CompilerServices.Unsafe.dll when linking against the UnityAot profile
at Unity.Linker.MonoBehaviorUtilities.DerivesFrom(UnityLinkContext context, TypeDefinition type, String possibleBaseNames)
at Unity.Linker.MonoBehaviorUtilities.IsOrDerivesFrom(UnityLinkContext context, TypeDefinition type, String possibleBaseNames)
at Unity.Linker.MonoBehaviorUtilities.IsMonoBehaviourOrScriptableObject(UnityLinkContext context, TypeDefinition type)
at Unity.Linker.Steps.Rooting.ResolveFromMonoBehaviours.b__6_0(TypeDefinition t)
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at Unity.Linker.Steps.Rooting.ResolveFromMonoBehaviours.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Unity.Linker.UnityPipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at Unity.Linker.UnityDriver.UnityRun(ILogger customLogger)
at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(ILogger customLogger)
at Unity.Linker.UnityDriver.RunDriver()

UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at <83a38f5397d94e36a22efa3369c82390>:0)
UnityEditorInternal.Runner.RunNetCoreProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1[T] setupStartInfo) (at <83a38f5397d94e36a22efa3369c82390>:0) UnityEditorInternal.AssemblyStripper.RunAssemblyLinker (System.Collections.Generic.IEnumerable1[T] args, System.String& out, System.String& err, System.String linkerPath, System.String workingDirectory) (at <83a38f5397d94e36a22efa3369c82390>:0)
UnityEditorInternal.AssemblyStripper.StripAssembliesTo (System.String outputFolder, System.String& output, System.String& error, System.Collections.Generic.IEnumerable1[T] linkXmlFiles, UnityEditorInternal.UnityLinkerRunInformation runInformation) (at <83a38f5397d94e36a22efa3369c82390>:0) UnityEditorInternal.AssemblyStripper.RunAssemblyStripper (UnityEditorInternal.UnityLinkerRunInformation runInformation) (at <83a38f5397d94e36a22efa3369c82390>:0) UnityEditorInternal.AssemblyStripper.StripAssemblies (System.String managedAssemblyFolderPath, UnityEditorInternal.BaseUnityLinkerPlatformProvider unityLinkerPlatformProvider, UnityEditorInternal.IIl2CppPlatformProvider il2cppPlatformProvider, UnityEditor.RuntimeClassRegistry rcr, UnityEditor.ManagedStrippingLevel managedStrippingLevel) (at <83a38f5397d94e36a22efa3369c82390>:0) UnityEditorInternal.IL2CPPBuilder.Run () (at <83a38f5397d94e36a22efa3369c82390>:0) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <83a38f5397d94e36a22efa3369c82390>:0)
UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at :0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at :0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <83a38f5397d94e36a22efa3369c82390>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Error 3
Build completed with a result of ‘Failed’ in 10 seconds (10016 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Error 4
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <83a38f5397d94e36a22efa3369c82390>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <83a38f5397d94e36a22efa3369c82390>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)


so i clicked it to “manage using unity lifecycle.” and now it brings up the camera.

however it is not creating the plane for the ar features. i have followed all of the getting started steps. any suggestions?

Hello Kyle,

I am not sure what you mean by “brings up the camera”, can they please elaborate? Also what AR features are you using that make use of a plane? What tutorials did you follow exactly?

same error on android, black background,through my phone,i can see the ball, but can not see the real world

it turns on the camera and i can see real world instead of black background.

and i used the getting started tutorial of how to set up the scene to start building our stuff from there.

and here is what i have in scene for plane rendering.

Hello Kyle,

The best suggestion I can make at this point is to go over the tutorials again and look for something you might have missed. The Basic Placement Tutorial has quite a few references on how to use plane’s in your scene. Is this what you were using to get this set up?

i used this one: ARDK Setup — Niantic Lightship Augmented Reality Developer Kit release-2.1 documentation

and going back though those steps that you mentioned, i have no AR Hit Tester script.

Hey Kyle,

Did this help resolve the problems you were experiencing? Is there anything further we can do to help?

@Winston Could you please file these errors your seeing in a new thread so we may address them more closely?