Skip to main content

ProGuard | React Native Document Scanner

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

For the Scanbot SDK React Native module

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

For the native Scanbot SDK


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/*/
-keepresourcefiles /lib/*/

-keepresourcefiles /lib/*/
-keepresourcefiles /lib/*/
-keepresourcefiles /lib/*/
-keepresourcefiles /lib/*/
-keepresourcefiles /lib/*/
-keepresourcefiles /lib/*/
-keepresourcefiles /lib/*/
-keepresourcefiles /lib/*/
-keepresourcefiles /lib/*/
-keepresourcefiles /lib/*/
-keepresourcefiles /lib/*/



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)


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

-keep public class { *; }

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

-keep public class**{ *; }

-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** { *; }

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

# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * { <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?