How to Add the Library to Your Android Studio Project

To create an application which uses ABBYY Mobile Capture SDK, you will need to add the library and its assets to your project. This is required for new projects only — packaged code samples work out of the box.

1. If you are using a Maven or Ivy repository, add the ABBYY Mobile Capture SDK package there. If not, you can copy the library *.aar files to your project or another folder and add this location as a flat repository. For example, add the following to the top-level build.gradle file in your project:

allprojects {
 repositories {
     flatDir {
         dirs '<path to folder with the .AAR files>'
     }
 }
}

2. Add the libraries dependency to the module-level build.gradle file for each required *.aar file. Please, specify the library name according to your distribution version: abbyy-rtr-sdk-1.0 or abbyy-mi-sdk-2.0 respectively. For example:

dependencies {
   implementation(name:'abbyy-rtr-sdk-1.0', ext:'aar')
   implementation(name:'abbyy-ui-1.0', ext:'aar')
}

3. In order to use UI components in your project add Kotlin std-lib dependency to the build.gradle file:

dependencies {
   implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.31'
}

 Note: Adding Kotlin std-lib to 'dependencies' does not add Kotlin support to your project, nor does it pose any restrictions to the language you are using. This is just a regular library dependency.

4. Copy the assets you need from the distribution to your project's assets (by default, app/src/main/assets). There are three types of resources used by the library: dictionaries, patterns, and translation dictionaries. See Distribution Kit for a detailed description of the necessary resources.

 Important! Your application needs Internet connection to gather the information about the current state of the library. Include the following line into your AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />

 Note:  If you use proguard minification or obfuscation in your release builds, add the following rules to the proguard-rules.pro file:

-keep class com.abbyy.mobile.rtr.** { *; }
-keep class com.abbyy.mobile.ocr4.** { *; }

10.09.2020 18:34:48