Prepare production app
Building production apps
iOS
The Scanbot SDK iOS Framework (included in this Flutter Plugin) contains 64-bit architectures (arm64, x86_64
).
You can thus run it on all commonly used iOS devices as well as on simulators during the development phase.
To be able to submit a production build to the App Store
or a test build for TestFlight you have to remove (strip away)
the architectures x86_64
and i386
from the Scanbot SDK Framework.
These architectures are only for simulators and not allowed to be submitted to iTunes Connect.
Android
The Scanbot Android SDK uses native libraries under the hood and supports the following
ABIs:
armeabi-v7a, arm64-v8a, x86 and x86_64
.
By default the native libraries of all these architectures
will be included in the app package (APK), which will result in a large APK file.
Please consider removing support for x86
and x86_64
architectures.
In most cases both "x86" architectures can be removed for the
release (production) build, since they are only used on emulators
and on some rare devices with the Intel Atom architecture.
To exclude certain ABIs from the APK, use the abiFilters
property
in the android/app/build.gradle
file of your project:
android {
...
defaultConfig {
...
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
// Please add "x86" and "x86_64" if you would like to test on an emulator
// or if you need to support some rare devices with the Intel Atom architecture.
}
}
}
In this example we defined abiFilters
for armeabi-v7a
and arm64-v8a
,
so x86
and x86_64
architectures will be excluded.
💡 However, if you need to support all architectures and would also like to optimize the APK size, we highly recommend checking out the Android App Bundle approach. It allows you to create and distribute dedicated, smaller APKs via the PlayStore (basically, it is similar to the iOS App Store approach).
ProGuard
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.**{ *; }
-keeppackagenames io.scanbot.sap.**
-keep public class io.scanbot.sap.** { *; }
-keepclassmembers enum io.scanbot.** {*;}
-keepclassmembers class io.scanbot.** extends java.lang.Enum {
<fields>;
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 com.google.gson.stream.** { *; }
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { <fields>; }
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends 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>;
}
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
##---------------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 LicenseWhat do you think of this documentation?
What can we do to improve it? Please be as detailed as you like.