Skip to main content

ProGuard | Cordova Barcode Scanner

Starting from v4.2.0, consumer ProGuard rules are integrated into the Scanbot Barcode SDK Cordova 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 Barcode SDK Cordova Plugin

-keeppackagenames io.scanbot.barcodesdk.plugin.cordova.**
-keep public class io.scanbot.barcodesdk.plugin.cordova.** { *; }
-keep public class io.scanbot.sdk.ui.** { *; }

For the native Scanbot Barcode SDK

If you use ProGuard for your release builds, please add the following ProGuard rules for all Scanbot Barcode Scanner SDK Packages:

Since Scanbot Barcode Scanner SDK for Android version 1.1.7, consumer ProGuard rules are integrated into the library and automatically applied to customers' modules.

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

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

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

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

-keep public class** { *; }

-keepclassmembers enum io.scanbot.** {*;}
-keepclassmembers class io.scanbot.** extends java.lang.Enum {
public static **[] values();
public static ** valueOf(java.lang.String);

# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**
-dontwarn org.jetbrains.annotations.**

-keepnames class kotlin.jvm.internal.DefaultConstructorMarker
-keep public class kotlin.reflect.jvm.internal.impl.** { public *; }
-keepclassmembers class kotlin.Metadata {
public <methods>;

##---------------Begin: proguard configuration for 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 of it.
-keepattributes Signature

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

# Gson specific classes
-dontwarn sun.misc.**
-keep class** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class** { <fields>; }

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

# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * { <fields>;
-keep,allowobfuscation,allowshrinking class
-keep,allowobfuscation,allowshrinking class * extends

##---------------End: proguard configuration for Gson ----------

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?