Skip to main content

Building Production Apps | React Native Barcode Scanner

Building Production Apps | React Native Barcode Scanner

iOS

The Scanbot Barcode SDK iOS Framework (included in this React Native npm package) contains the most used architectures (arm64, armv7, x86_64, i386). You can thus run it on most 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 Barcode Scanner SDK Framework. These architectures are only for simulators and not allowed to be submitted to App Store Connect.

To accomplish this, we provide a script strip-SBSDK-Framework.sh which is part of the ScanbotBarcodeScannerSDK.framework and can be easily integrated in the build process. This script removes the unnecessary architectures from the frameworks binary, code signs the framework and adds the crash symbols (dSYM) file to your app's archive. The final package size (IPA) of your app will then be significantly smaller than a debug version used during the development phase.

To add this script in your build process, you will need to open the Xcode workspace .xcworkspace and apply a few changes there:

  1. Go to TARGETS settings and open the tab Build Phases. Add a new Run Script Phase via "+" button.
  2. Adjust this Run Script Phase with the following script data:

Script code:

bash "${PODS_ROOT}/ScanbotBarcodeScannerSDK/ScanbotBarcodeScannerSDK.framework/strip-SBSDK-Framework.sh"

Script Input File:

${PODS_ROOT}/ScanbotBarcodeScannerSDK/ScanbotBarcodeScannerSDK.framework.dSYM

alt

Android

Scanbot Barcode Scanner 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 big 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 Gradle settings of your project.

Please check and adjust the abiFilters configuration in your build.gradle file accordingly:

android {
...
defaultConfig {
...
ndk {
// a typical production configuration:
abiFilters "armeabi-v7a", "arm64-v8a"
}
}
}

💡 However, if you need to support all architectures and to optimize the APK size, we highly recommend checking out the Android App Bundle approach. It allows you to create and distribute dedicated and smaller APKs via the PlayStore (basically it is similar to the iOS App Store approach).

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?