# Unity augmented reality app doesn't work on android

I am pretty new to unity and augmented reality applications. I use unity 2019.4.4f1 and my project is very simple as you can see in the screenshot below:

I am using Wikitude plugin for image tracking and the image i am using as the marker is the Jack of Clubs card as you can see in the assets. The project works fine when i press play and use my laptop's webcam , but when i build the project for android (unity 2019 automatically uses Gradle to build the project) and install the .apk file in my android phone, all i see on my phone screen when i open the application is:

As you can see the phone camera doesn't work and it gets stuck in this screen. How should i fix it? Does it have to do something with Gradle? I haven't tried using unity version 2018 to build it using the "Internal" build option. Anyways that's just my own thought and i might be wrong, but the final question remains which is how this problem can be fixed?

By the way i don't build the .apk file directly from the unity engine. I use the export option in unity to get a gradle project folder then i use that in Android Studio to build the final .apk file. The reason that i don't use unity to build .apk is that it gives errors and doesn't work for me so this is the solution i found for it.

Update: I debugged the application and it seems that the application needs camera permission to work, this is my debugging log:

07-22 17:47:16.908: E/Unity(32483): On Camera Error
07-22 17:47:16.908: E/Unity(32483):         Error Code: 1000
07-22 17:47:16.908: E/Unity(32483):         Error Domain: com.wikitude.camera.android
07-22 17:47:16.908: E/Unity(32483):         Error Message: Permission denied. Make sure to have camera permissions before trying to access the camera.
07-22 17:47:16.908: E/Unity(32483):
07-22 17:47:16.908: E/Unity(32483): (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)



I'm pretty sure that it didn't ask for camera permission, how should i allow the permission if it's not asking?

• We'll likely need more debugging info to be able to troubleshoot this effectively. Have you tried adding logging at each step, and checking the logs to see where the game gets stuck / what errors arose? Jul 22 '20 at 12:02
• @DMGregory I am very new to unity and i actually don't know how to do debugging, is there any way for me to learn how to do that? Jul 22 '20 at 12:19
• Did you start by searching "debug unity android build" and researching the resources that pulled up? Jul 22 '20 at 12:24
• @DMGregory I did now and i learned how to do debugging, now i have updated my question with the debug log. Jul 22 '20 at 13:25
• Looks like you should edit your question to show us the code that enables camera permission, and how you've structured your game to ensure that code runs before Wikitude tries to use the camera. Jul 22 '20 at 13:31

#if PLATFORM_ANDROID