Skip to main content
Kofax

Reference Mobile SDK libraries in Android

21481

Question / Problem:

How to reference the mobile SDK libraries in Android

Answer / 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:

  1. Get the entire MobileSDK_Libs/ folder contents and copy that into the libs/ folder of the project.
  2. Delete any .aar files in the copied version of the folder.
  3. Open the project's AndroidManifest.xml file.
  4. 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" />
  5. If using the Packaged Capture Experience, additional AndroidManifest modifications will be required.

To use the AAR file:

  1. Get the entire MobileSDK_Libs/ folder contents and copy that into the libs/ folder of the project.
  2. Delete the SDK JAR file.
  3. Add the libs folder as a flat file repository and the SDK reference by adding this to the project's dependencies {} closure:
    repositories {
       flatDir {
          dirs 'libs'
       }
    }
    compile(name:'sdk-release', ext:'aar')

Applies to:

Product Version Category
MOBILESDK 2.4 Development
MOBILESDK 2.5 Development
MOBILESDK 2.6 Development
  • Was this article helpful?