Documentation

Project Setup

There are only a few steps necessary to add the Wikitude SDK to your Android application. This guide will explain them in detail.

Create an Android project

  • Create a new Android Studio Application Project (There is also a working GettingStartedProject and a SampleProject bundled in this SDK, where these steps are already made)

Adding the Wikitude SDK

  • Download the Android Native SDK example and copy the wikitude_native_sdk.aar file, that is located in the Library folder, into the libs folder of your module (project root/app/libs)

  • Open build.gradle (Module: app), add the wikitude_native_sdk.aar as a dependency and tell gradle to search the libs folder, like in the code below.

android {
    ...
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation (name: 'wikitude-native-sdk', ext:'aar')
    implementation "com.google.ar:core:1.5.0"
    ...
}

repositories {
    flatDir{
        dirs 'libs'
    }
}

Optionally you can include the Wikitude SDK using our custom maven repository instead.

  • Add https://cdn.wikitude.com/sdk/maven as maven source to your project. This is usually done in the top level build.gradle.
buildscript {
    repositories {
        jcenter()
        google()
        maven {
            url 'https://cdn.wikitude.com/sdk/maven'
        }
    }
    ...
}

allprojects {
    repositories {
        jcenter()
        google()
        maven {
            url 'https://cdn.wikitude.com/sdk/maven'
        }
    }
}
  • Open build.gradle from your module and add com.wikitude:native:9.0.0 as a dependency like in the code below.
android {
    ...
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.wikitude:native:9.0.0'

    implementation 'com.android.support:appcompat-v7:21.0.3'
    implementation 'com.google.ar:core:1.5.0'
}
  • If you already purchased a license, please set the applicationId to the package name you provided us with.
    defaultConfig {
        applicationId "xxxx"
    }

Add permissions

  • Add the following permissions and features to your AndroidManifest.xml
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />

    <uses-feature android:glEsVersion="0x00020000" android:required="true" />
    <uses-feature android:name="android.hardware.camera" android:required="true" />
Note: Since Android 6.0+ you need to make sure your app has the camera runtime permission before calling WikitudeSDK.onCreate().
  • Also in the Android manifest define following config changes for the activity which adds the OpenGL view
        <activity
            android:name="YOUR_PACKAGE_NAME.YOUR_ACTIVITY_NAME"
            android:configChanges="orientation|keyboardHidden|screenSize" />

Trial license key generation

WTC file generation

  • Read this chapter on how to create a .wtc file, which you will later need to track the images you want. In the Image Tracking section, you can learn more about how to track those images.