Note: At this point, you should already have completed Base app configuration section.
In order to configure the building of your application for an Android platform, you can either rely on automatic command which will everything for you, or follow to manual steps.
Note: Automatic configuration works only for Unix like OS.
-
Add the following command to your
scriptssection of your apppackage.json:- Linux, Windows:
"scripts": { ... "evernym-sdk:configure-android": "./node_modules/@evernym/react-native-white-label-app/files/android/configure-android.sh" },
- MacOs
"scripts": { ... "evernym-sdk:configure-android": "./node_modules/@evernym/react-native-white-label-app/files/android/configure-android-mac.sh" },
- Linux, Windows:
-
Run the following command in your project directory:
yarn evernym-sdk:configure-android
-
To build app with SDK, you need to increase the available jvm memory in
android/gradle.propertiesorg.gradle.jvmargs=-Xmx4608m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
Add blacklist to your
android/gradle.propertiesandroid.jetifier.blacklist=bcprov -
Set distribution url in your
android/gradle/wrapper/gradle-wrapper.propertiesdistributionUrl='https\://services.gradle.org/distributions/gradle-6.9-bin.zip
-
Set the minimum supported SDK version in your
android/build.gradle:buildscript { ext { ... minSdkVersion = 23 ... } ... -
Add the libvcx android repositories in your
android/build.gradle:allprojects { repositories { ... maven { url 'https://evernym.mycloudrepo.io/public/repositories/libvcx-android' } maven { url 'https://evernym.mycloudrepo.io/public/repositories/evernym' } } } -
Set gradle version and add kotlin dependence in your
android/build.gradle:dependencies { classpath 'com.android.tools.build:gradle:4.2.1' classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20' ... } -
Setup packaging options in your
android/app/build.gradle:android { ... packagingOptions{ pickFirst 'lib/armeabi-v7a/libc++_shared.so' pickFirst 'lib/arm64-v8a/libc++_shared.so' pickFirst 'lib/x86_64/libc++_shared.so' pickFirst 'lib/x86/libc++_shared.so' if (enableHermes) { exclude '**/libjsc*.so' } } ... } -
Add fonts in your
android/app/build.gradle:apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
-
Set default configuration for the camera in your
android/app/build.gradle:android { ... defaultConfig { ... missingDimensionStrategy 'react-native-camera', 'general' } ... } -
Add kotlin dependence in your
android/app/build.gradle:dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.20" ... } -
Replace your
android/app/src/main/AndroidManifest.xmlwith AndroidManifest.xml and change placeholders (react-native-white-label-app-placeholder) in copiedAndroidManifest.xml:
package- your original android package name
-
Create
android/app/src/main/res/xml/folder and copy file_viewer_provider_paths.xml file there. -
Update your
MainActivityby adding the following code (it's needed to configure your app storage):import android.content.ContextWrapper; import android.system.Os;
@Override protected void onStart() { super.onStart(); try { ContextWrapper c = new ContextWrapper(this); Os.setenv("EXTERNAL_STORAGE", c.getFilesDir().toString(), true); } catch (Exception e) { e.printStackTrace(); } }
There are two strategies regarding receiving messages by an application which described here:
If you wish to use Push Notifications strategy you need to set variable USE_PUSH_NOTIFICATION=true and follow steps bellow to configure Google Firebase for Android:
Official documentation: https://developer.android.com/guide/topics/ui/notifiers/notifications
-
Put
google-services.jsonfile into yourandroid/appfolder. Example file can be found (showing structure) here. Note that push notifications will not work if you use this file, to get working notifications you need to provide your own account information. -
Add
google-servicesdependencies into yourandroid/build.gradlefile.dependencies { ... classpath 'com.google.gms:google-services:4.2.0' } -
Add
google-servicesplugin into yourandroid/app/build.gradlefile.apply plugin: 'com.google.gms.google-services'
-
Uncomment the text located under
Firebase configurationinAndroidManifest.xml:
-
Uncomment the text located under
Deep Linking configurationinAndroidManifest.xml: -
Set Branch keys in your
android/app/build.gradlefile:manifestPlaceholders = [BRANCH_LIVE_KEY: "key_live_....", BRANCH_TEST_KEY:"key_test_..."] -
Change placeholders (
react-native-white-label-app-placeholder) forBranch URI SchemeandBranch App LinksinAndroidManifest.xml: -
Added branch import into your
MainApplication.java:// branch needs to have a referral in initializing import io.branch.referral.Branch;
Solution: Add patch into your project for the following package:
react-native-screens- link
Solution: Add patches into your project for the following packages: