Start a new topic
Solved

Camera is not working on Android.

Hi,

I am using Unity 2018.3.3 and I notice that the camera never turns on. I deselected the multithread rendering, camera2 API, and metal. I tried both IL2PP and mono, but the camera always shows a black background.


I tried Unity 2018.2 with Wikitude 8.2 SDK. The camera works perfectly on Android and IOS phone. But it never works on Unity 2018.3.3. 

I can't downgrade unity because all prefabs in my project will be messed up. 

Is there any way I can solve the problem?


Thank you.


Thank you so much! Now, the camera works perfectly after I added the permission code to my main scene on Unity 2018.3.3.


if (!Permission.HasUserAuthorizedPermission(Permission.Camera)) {

            Permission.RequestUserPermission(Permission.Camera);

        }


2 people like this

Hi, 


Yes, the problem is that in 2018.3, Unity added new APIs to handle Android Runtime Permissions, and so they don't automatically ask for the camera permission when the app starts anymore. This is not something we can handle either, because we would like to let developers be in control of when permissions are asked, but in MenuController.cs, in the Awake method, you can see an example of how to handle this. I assume that in your tests you are not using this.

Please let us know if this fixes the problem for you.


Best regards,

Alexandru


1 person likes this
@Mirko Gleichauf I couldn't see UnityEngine.Android.permission in your script. Make sure that it is added.

Hi, 


@John: The main issue is that the "unity_android_bridge.aar" library is missing from your project. Can you please double-check that this is present in your project?


@Mirko: You don't need the entire MenuController, just the part that's in the Awake method. Can you please make sure that it's called, by adding a Debug.Log in it and playing the scene in the Editor? Can you also double-check that the scene is included in the build?


Best regards,

Alexandru

Hi,


i added UnityEngine.Android.permission in my script. It doesn´t work at all. I don´t know what i can do now...


Best regards

Mirko

console1.png
(27.5 KB)

image


I have checked for bridge.aar file it is present inside my Unity project folder. I am using the whole unity project as a library inside Android. Even the camera permission is asking the problem is still a black screen.


Following two errors are in my Logcat.


2019-07-31 14:28:18.718 3491-3491/com.xrlab.nymmunity E/MPlugin: Unsupported class: com.mediatek.common.telephony.IOnlyOwnerSimSupport


(Filename: currently not available on il2cpp Line: -1)

2019-07-31 14:28:25.640 3491-3518/com.xrlab.nymmunity E/Unity: NullReferenceException: Object reference not set to an instance of an object.

      at Wikitude.WikitudeCamera.Update () [0x00000] in <00000000000000000000000000000000>:0 

     

A unity project without a camera is working fine inside Android studio when unity is used as a library.

Since missing unity_android_bridge.arr, I also tried to add it as a library inside the Android studio and synced.


I don't know it is a correct method or not but Android studio Logcat showing unity_android_bridge.arr is unable to locate.

What still I am trying to do is

Opening UnityPlayerActivity.class from an empty android activity on button click.


https://www.wikitude.com/external/doc/documentation/6.1/unity/setupguideunity.html


Here you specified how to launch it from Android studio.

But I wanted the entire unity project as a library for using inside Native android application.

@Mirko can you send the project file.

Yes i can do that. I give you my email so we can stay in contact. mirko.gleichauf@iteos.de


Best regards

Mirko

I created a unity 3d plugin wikitude project and import it as a .aar file inside android studio. Everything working fine except the wikitude camera is not turning on inside android studio project. 

I ran the unity project itself instead of a library and seems to be working fine. 

Why the camera is not opening inside android studio project while I am using it as a library .aar

Hi, 


Which version of Unity and the Wikitude SDK are you using? On which devices are you testing?

Are you asking for camera permissions?

Are there any error messages in the logs?


Thank you,

Alexandru


ERROR: Unable to resolve dependency for ':unityLibrary@debugAndroidTest/compileClasspath': Could not find :unity_android_bridge:.

Show Details

Affected Modules: unityLibrary



ERROR: Unable to resolve dependency for ':unityLibrary@debugUnitTest/compileClasspath': Could not find :android_component:.

Show Details

Affected Modules: unityLibrary



ERROR: Unable to resolve dependency for ':unityLibrary@debugUnitTest/compileClasspath': Could not find :unity_android_bridge:.

Show Details

Affected Modules: unityLibrary


I followed the latest unity tutorial and I am getting this error while integrating Wikitude cam. Please help me to solve this ASAP


Regards,

Jibin John

Hello,


i also have the problem with the permission by android. I tried to add the MenuController.cs to the WikitudeCamera and it didn´t work. Where can I add the MenuController.cs? Do i have to change something in the MenuController.cs or in the Android manifest?


Best Regards,

Mirko

Login or Signup to post a comment