Skip to main content

ProGuard

Starting from v4.2.0, consumer ProGuard rules are integrated into the Scanbot SDK Capacitor Plugin and automatically applied to customers modules.

If you use older version and have ProGuard/R8 enabled for the release/production build, please add the following rules:

For the Scanbot SDK Capacitor Plugin

-keeppackagenames io.scanbot.sdk.capacitor.** { *; }
-keep public class io.scanbot.sdk.ui.** { *; }

For the native Scanbot SDK

v1.94.0+

ProGuard rules are integrated into the library and automatically applied to customer's modules.

But, customers who are using DexGuard tool for the obfuscation of the release application, have to add the following rules to the DexGuard configuration to keep the names of .so files unchanged for the Scanbot SDK:

-keepresourcefiles /lib/*/libscanbotsdk.so
-keepresourcefiles /lib/*/libtflite.so

-keepresourcefiles /lib/*/libscanbotsdkdata_gdr.so
-keepresourcefiles /lib/*/libscanbotsdkdata_docdetector.so
-keepresourcefiles /lib/*/libscanbotsdkdata_mcform.so
-keepresourcefiles /lib/*/libscanbotsdkdata_blurdetector.so
-keepresourcefiles /lib/*/libscanbotsdkdata_lcd.so
-keepresourcefiles /lib/*/libscanbotsdkdata_commonocr.so
-keepresourcefiles /lib/*/libscanbotsdkdata_ehic.so
-keepresourcefiles /lib/*/libscanbotsdkdata_ocrb.so
-keepresourcefiles /lib/*/libscanbotsdkdata_barcodev2.so
-keepresourcefiles /lib/*/libscanbotsdkdata_barcodev3.so
-keepresourcefiles /lib/*/libscanbotsdkdata_licenseplate.so

v1.74.0+

info

Since Scanbot SDK version 1.74.0 consumer ProGuard rules are integrated into the library and automatically applied to customers' modules.**

If you are using an older Scanbot SDK version you have to add these ProGuard rules for all Scanbot SDK Packages:

v1.73.x (or older)

-ignorewarnings

-keep public class io.scanbot.sdk.ui.** { *; }

-keep public class io.scanbot.sap.SapManager { *; }

-keeppackagenames io.scanbot.sdk.core.contourdetector.**
-keep public class io.scanbot.sdk.core.contourdetector.**{ *; }

-keeppackagenames com.googlecode.tesseract.android.**
-keep public class com.googlecode.tesseract.android.**{ *; }

-keeppackagenames io.scanbot.sdk.core.payformscanner.**
-keep public class io.scanbot.sdk.core.payformscanner.**{ *; }

-keeppackagenames io.scanbot.mrzscanner.**
-keep public class io.scanbot.mrzscanner.**{ *; }

-keeppackagenames io.scanbot.dcscanner.**
-keep public class io.scanbot.dcscanner.**{ *; }

-keeppackagenames io.scanbot.tiffwriter.**
-keep public class io.scanbot.tiffwriter.**{ *; }

-keeppackagenames io.scanbot.chequescanner.**
-keep public class io.scanbot.chequescanner.**{ *; }

-keeppackagenames io.scanbot.textorientation.**
-keep public class io.scanbot.textorientation.**{ *; }

-keeppackagenames io.scanbot.barcodescanner.**
-keep public class io.scanbot.barcodescanner.**{ *; }

-keeppackagenames io.scanbot.hicscanner.**
-keep public class io.scanbot.hicscanner.**{ *; }

-keeppackagenames io.scanbot.sdk.process.**
-keep public class io.scanbot.sdk.process.**{ *; }

-keeppackagenames io.scanbot.multipleobjectsscanner.**
-keep public class io.scanbot.multipleobjectsscanner.**{ *; }

-keeppackagenames io.scanbot.idcardscanner.**
-keep public class io.scanbot.idcardscanner.**{ *; }

-keeppackagenames io.scanbot.generictext.**
-keep public class io.scanbot.generictext.**{ *; }

-keeppackagenames io.scanbot.nfcscanner.passport.**
-keep public class io.scanbot.nfcscanner.passport.**{ *; }
-keep public class io.scanbot.nfcscanner.**{ *; }

# Gson
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all this information.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-dontwarn sun.misc.**
-keep class com.google.gson.stream.** { *; }

# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * implements com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get your free Trial License

What do you think of this documentation?