Reference Android SDK Libraries
Article # 3037232 - Page views: 25
Issue
How to reference the mobile sdk libraries in Android
Solution
There are two different methods for referencing and using the SDK:
- Use the JAR (both Eclipse and Android Studio)
- Use the AAR (Android Studio)
These two methods have different implications and instructions.
Whether using the JAR or the AAR, if you're using Android Studio, ensure you have this line in the dependencies {}
closure in the build.gradle
file of the project:
compile fileTree(dir: 'libs', include: '*.jar')
To use the JAR:
- Get the entire
MobileSDK_Libs/
folder contents and copy that into thelibs/
folder of the project. - Delete any
.aar
files in the copied version of the folder. - Open the project's
AndroidManifest.xml
file. - Inside the
<application>
node, add this XML:
<meta-data android:name="roboguice.annotations.packages" android:value="com.kofax" />
<meta-data android:name="roboguice.modules" android:value="com.kofax.mobile.sdk.capture.MainModule" /> - If using the Packaged Capture Experience, additional AndroidManifest modifications will be required.
To use the AAR file:
- Get the entire
MobileSDK_Libs/
folder contents and copy that into thelibs/
folder of the project. - Delete the SDK JAR file.
- Add the
libs
folder as a flat file repository and the SDK reference by adding this to the project'sdependencies {}
closure:
repositories {
flatDir {
dirs 'libs'
}
}
compile(name:'sdk-release', ext:'aar')
Level of Complexity
High
Applies to
Product | Version | Build | Environment | Hardware |
---|---|---|---|---|
Mobile SDK | all |
Article # 3037232