Black screen finished build

  • Issue category: Finished build; Camera
  • Device type & OS version: Android
  • Host machine & OS version: Windows
  • Issue Environment : On Device
  • Xcode version: Not applicable ¿
  • ARDK version: 2.4.2
  • Unity version: 2021.3.8f1

Description of the issue:
I was trying to make an app with the template of Image detection.
In the scene I basically replaced the balloon with the object that I wanted to instantiate virtually and in the AR image detection manager I added the Niantic “crowd” image as bytes, name and physical width. I also added the same name to the Image detection controller script in the inspector.
Basically that is what I did with the scene but I think it’s not relevant because my app didn’t get to open the camera.

When trying to compile the app I encountered several issues with the gradle and the android manifest, so I will detail what my app has:

  • In the Preferences/external tools the only thing I did was changing the gradle and instead of using the one installed in Unity I was using this one: “gradle-6.7.1”
  • In the Player/Publishing settings I ticked both the custom main manifest, where i added this code
<queries>
	<package android:name="com.google.ar.core" />
</queries>

and the custom base gradle template where i modified this line like this: com.android.tools.build:gradle:4.2.0.

  • Lastly, in graphics API I removed Vulkan and only have OpenGLES3, the minimum API level is 24, Android 7.0, I activated IL2CPP AND arm64 and that is it.

Some of these modifications, such as those related to the gradle and the android manifest, were made because I wasn’t able to build the app. With those modifications I am able to build the app but I just see the canvas and a black screen. I do get the message requesting permission though but even after accepting the camera is still black.
I have also tried other settings, such as other API levels but neither worked.
My android devide is Xiaomi 11T, android version is 13TP1A.220624.014.

I have tested it using virtual studio and there it does work.
I have also tried Unity remote but that was not very helpful, since I could just see the same as in the game tab of the computer.

I know there are several issues regarding black screens but I checked many of them and tried several solutions.

Hello JC,

Can you retry building with a new Unity project but this time after checking the box for the Custom Main Manifest, don’t manually insert the line you said you inserted in your post. The latest versions of ARDK have the Manifest automatically filled in at the time of building; all you have to do is check the box for the custom Manifest. I’ve noticed that some users have run into black screen issues when manually editing the Manifest even if they’re adding in the correct lines.

For your reference, here is the link to our Android build guide

Hi, @Jesus_Hernandez ,
Thank you very much for your quick answer. I tried your suggestion but it didn’t work. I am trying it now with 2021.3.22f1 and I am going to try it with 2020.3.46f1 and with ARDK 2.5.1. Do you have any other suggestion that maybe I can try? Should I keep trying in the previous versions?

Hi JC,

If you have already confirmed that you have changed the Gradle Path (Edit → Preferences → External Tools → scroll to the bottom to check the Android section) and also made sure that you changed the plugin version on the Custom Main Gradle to 4.2.0. (Unlike the custom manifest, that one doesn’t get edited automatically) then can you build and run your project while keeping your device connected to your computer and provide the errors you’re getting in the logcat?

The logcat is very long. In order to get only the relevant information could you advice how to filter only the relevant stuff?
I wrote in the browser the name of the app “maderaula” and the errors i got (the ones in red) are these 4 (but im sure neither of these are the ones important):
2023/04/04 03:20:44.344 1307 1414 Error WindowManager win=Window{38ea446 u0 Splash Screen com.DefaultCompany.MaderaulaFinal EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true
2023/04/04 03:21:50.871 1693 10080 Error DollieAdapterService notifyActivityState pkg:com.DefaultCompany.MaderaulaFinal/com.unity3d.player.UnityPlayerActivity state:11 fg:false mUid:10240
2023/04/04 03:21:50.989 1693 10080 Error DollieAdapterService notifyActivityState pkg:com.DefaultCompany.MaderaulaFinal/com.unity3d.player.UnityPlayerActivity state:11 fg:false mUid:10240
2023/04/04 03:21:51.408 1307 6178 Error WindowManager win=Window{2327bc9 u0 com.DefaultCompany.MaderaulaFinal/com.unity3d.player.UnityPlayerActivity} destroySurfaces: appStopped=true win.mWindowRemovalAllowed=false win.mRemoveOnExit=false
I believethis line is when I started the app but its hard to say:

Hi JC,

The logcat doesn’t appear to have a way to filter error messages, the filter options and search bar at the top don’t seem to take into account the Priority column so you can’t filter by errors.

What you can do to send the entire logcat is click on the first output line and once it’s highlighted, scroll all the way down to the last line and hold down shift and click on the last line. Or if the shortcut works for you, you can also select everything by hitting Ctrl+A

This will highlight the entire output and you can just right click and save it as a text file and send it over to me.

Thank you very much for your help!
I will send you the complete logcat.
logcat 1.txt (289.2 KB)
logcat 2.txt (379.5 KB)
The first version is a little shorter because I am concerned with the length of the logcat and I wanted to save you the trouble of looking through so many lines, so I waited maybe 2 seconds before disconnecting the logcat tool in unity and stop generating output. However in the second version I waited a bit longer, maybe 5 seconds or so. So if the bug doesn’t appear in the first logcat I am sure it will appear in the second. Still, if you want more logcats let me know.

Hi JC,

I would need the remainder of the logs as well. I went through these and, while there were errors, none of them were ARDK related. ARDK didn’t appear at all in these logs.

Hi, @Jesus_Hernandez
This time I have used the log of the report generator of android. I think it’s more complete than the android logcat tool from unity (or at least it seems much longer). Also, it lasted like 5 minutes before ending. Also, I started running the report before I installed the app, in case the issue was with the installation of the app or something like that.
However I have reviewed it and ARDK is nowhere to be found in the report. There are a bunch of errors related to camera permission and other things but I’m not sure if those are relevant at all. In any case I will leave the full report and the dumpstate log.
Thank you very much for your help again!
bugreport-FLA-LX1-HUAWEIFLA-LX1-2023-04-08-03-58-43.txt (30.7 MB)
dumpstate_log.txt (41.0 KB)

Hi JC,

Yeah I also noticed that there were no ARDK related errors in these logs either. Does this device experience any issues in general with the Camera? Or maybe other AR Apps?

I was also wondering if you happen to be using any other packages other than ARDK.

No, it usually doesn’t. Actually I did a project with vuforia and that one did work. In this project the only pakages that I installed were ARDK and LightshipHub.

Hi JC,

Can you send me screenshots of the following:

  • The Other Settings and Publishing Settings tabs which can be found under Edit → Project Settings → Player
  • The Android section under Edit → Preferences → External Tools
  • Your ARRenderingManager, ARCameraPositionHelper, and AndroidPermissionRequester
  • Gradle Base Project Template which can be found under your Assets in Plugins → Android
    I know it’s a lot but I’d like to have a look to see if I can find any issues. Lastly, just double check that you do not have a manually edited Manifest. As mentioned previously, the Manifest is now updated automatically when building so you shouldn’t be touching it anymore.

Here I send you everything.
The ARRenderingMnager, ARCameraPositionHelper and AndroidPermissionRequester I send you a picture from the inspector because I didn’t touch the script, but if you want I can show them to you as well.









Hi JC,

Can you show me the structure of the Gradle folder you’re pointing your project to? I don’t see anything wrong with what you’ve sent me. Can you maybe try unchecking the custom manifest and then build? Since it’s automatically filled, you technically don’t need the custom one enabled.