Start a new topic

Object Tracking black screen comes, camera won't start

Hi Folks

I am working on Object Tracking Android Native API. SDK version 9.5.0.

I am facing issue of black screen on loading of .wto file from android assets folder. 

Camera is not starting to track the object. I have created separate project and taking help from wikitude sample example. 

Permission already given of Camera during runtime as Android OS version is 10.

Wikitude Camera permission is also checked during runtime.

Check of Supportive Device is also checked.

I have trail license key and separate project of object tracking.

When I load below two line after setting up Configuration blank screen appears and If I comment these two lines camera start working but it won't track the object.

final TargetCollectionResource targetCollectionResource = wikitudeSDK.getTrackerManager().createTargetCollectionResource("file:///android_asset/bottle.wto");

wikitudeSDK.getTrackerManager().createObjectTracker(targetCollectionResource, MainActivity.this, null);

Please help me on this. I did so much brain storming to solve this but not able to get root cause.


I don't see anything wrong with your code from the details you give me, but I can't reproduce your issue in our sample app, so I would need more information about how are you reproducing this to keep investigating the issue. Please answer the next questions so I can have a better idea: Did you try our native sample application? Did the Object Tracking samples work in the same device? Which device are you using? Is the bottle.wto placed in the path you mention? Is the .wto valid?



Hi Aitor

Good to see your response.

Yeah I tried your native sample app and it is working perfectly fine. 

It is doing object tracking in my same device.

Device Name: Xiaomi Note Pro 7, Android version 10.

Yeah bottle.wto is placed in correct path.

Yeah .wto is valid. I created it from wikitude studio.

You can look into this link for more clearance.



I can see a big difference that may be causing this issue: we always call wikitudeSDK.onResume() after the wikitudeSDK.onCreate() (which must be done) while in your sample this is not happening as you are checking if your device supports the OBJECT_TRACKING feature, and then wait for the checkPermissions callback to be called.

I'm pretty sure that with this approach, the onCreate() method is called after the onResume() and will cause it to not work. Isn't there any log from the sdk warning you about it?

My suggestion would be: move the onResume() call or check the permission and the isDeviceSupporting outside the Activity.

Please let me know if it worked or not.



1 person likes this

Hey Aitor

Thanks for your keen looking into my code. I notice that wikitudeSdk.onResume() is getting called before wikitudeSdk.onCreate().

My camera is started. But it is not detecting my object.

Log that is I am getting

2021-03-03 18:32:23.436 26572-28376/com.example.wititude V/SimpleObjectTracking: Object tracker loaded

Just this, after that nothing happening.

Can you help me on this?



I can't see anything wrong with your code if you have moved the onResume method. Maybe you could try your object in our sample app to see if there's actually a problem with the wto itself.



I am also seeing the blank screen directly in the unmodified Wikitude sample app from Native SDK 9.1.0, in the Tracking > Simple|Multiple|Extended examples. Detailed repro below.

## Environment

1. WikitudeSDK_NativeAPI_Android_9-10-0_2021-08-23_23-36-05

2. Android Studio Arctic Fox | 2020.3.1 Patch 4

3. Google Pixel 6

4. Android 12

5. Windows 10

## Repro

1. Open <sdk-dir>\Examples\NativeSDKExamples in Android Studio

2. Build and deploy to device (Pixel 6)

3. Launch

4. Click Image Tracking > Simple

5. Observe Screen (Black)

6. Click Back, then Tracking > Multiple Targets

7. Observe Screen (Black)

8. Click Back, then Tracking > Extended Targets

9. Observe Screen (Black)

10. Repeat 4-9 as many times as you like

11. Click Back, then Cloud Recognition > Single Recognition

12. Observe Screen (Camera Working Correctly)

13. Click Back, then Tracking > Simple

14. Observe Screen (Black)

15. Click Back, then Instant Tracking > Simple

16. Observe Screen (Camera Working, Red rectangle in scene)

17. Click Back, then Tracking > Simple

18. Observe Screen (Working now!)

## Expected

- Camera to work in all cases (5, 7, 9, 14)

## Actual

- Camera is not working, area where camera should display is black in steps 5, 7, 9, 14.

- Camera starts working in the Image Tracking examples (18) only after first trying the Instant Tracking > Simple example (16).

## Fix (But Disables Tracking...)

1. Open from `Examples\NativeSDKExamples\app\src\main\java\com\wikitude\samples\tracking\image\`

2. Comment out line 49: `wikitudeSDK.getTrackerManager().createImageTracker(targetCollectionResource, this, null);`

3. Run app, deploying to device

4. Click Tracking > Simple

5. Observe Screen (Working!)

## Expected

- Camera works

- Tracks images

## Actual

- Camera works

- Does not track images (since we commented that out to get the camera working.
















Sorry, to clarify, I was seeing this in 9.10.0 originally.

I've rolled back the Wikitude library to find where it may have broken, and found that 9.0.0 works correctly, but 9.1.0, 9.2.0, etc. all the way up to 9.10.0 produce the black screen / no camera. 

When configuring Android Gradle Plugin (AGP), Gradle, and the NDK, I referred to these two tables


For releases of Wikitude that do  not specify an NDK version, or used AGP 3.5 or older, which do not specify a default NDK, I updated AGP to 3.6 which uses NDK 20.0.5594570 by default. 

In summary

  1. Tracking > Image works correctly in 9.0.0 but produces a black screen in 9.1.0 and newer
  2. When building, update File > Project Structure > Project to use AGP 3.6.4 and Gradle Version 5.6.4, and ensure NDK 20.0.5594570 is installed

Please let me know if I can provide more diagnostics, and if there is a workaround for this issue.

Also verified that the sample app has the failure when built using the the 9.1 version from the maven repo

  • implementation "com.wikitude:native:9.1.0"
But works fine when using the 9.0 version
  • implementation "com.wikitude:native:9.0.0"

So the workaround for this issue is 
  1. Revert to using 9.0.0 release, either from source or using the maven repo
  2. If building from source, use AGP 3.6.4, Gradle 5.6.4, and NDK 20.0.5594570

Note that while this does fix the issue, it reverts to a version of Wikitude from March 2020.

Hi Eric,

The black screen issue you are reporting with 9.10.0 is something we cannot reproduce. Did you only test with the Google Pixel 6? Do you have the chance to test it with other devices? In our case we have a Google Pixel 3A XL and a Google Pixel 3, and in both devices everything is working fine, so it would be good to know if this is actually happening only in your Pixel 6 or in several devices.

Once I have more info from you side I can notify our QA team about this behaviour.

Thank you,


Login or Signup to post a comment