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 theLibrary
folder, into the libs folder of your module (project root/app/libs)Open
build.gradle (Module: app)
, add thewikitude_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.1.0"
...
}
repositories {
flatDir{
dirs 'libs'
}
}
- 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
- Read this chapter on how to obtain a free trial key, which you will later pass to the Wikitude Native SDK.
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.