2020-08-24 12:24:10 +00:00
|
|
|
def taskRequests = getGradle().getStartParameter().getTaskRequests().toString().toLowerCase()
|
2020-12-14 16:20:32 +00:00
|
|
|
def isFoss = taskRequests.contains("foss")
|
2020-08-24 12:24:10 +00:00
|
|
|
|
2017-08-03 18:23:43 +00:00
|
|
|
apply plugin: "com.android.application"
|
2019-09-16 20:26:32 +00:00
|
|
|
apply plugin: 'kotlin-android'
|
2023-05-18 21:09:33 +00:00
|
|
|
apply plugin: "com.facebook.react"
|
2020-08-24 12:24:10 +00:00
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
if (!isFoss) {
|
2020-08-24 12:24:10 +00:00
|
|
|
apply plugin: 'com.google.firebase.crashlytics'
|
|
|
|
apply plugin: 'com.bugsnag.android.gradle'
|
|
|
|
}
|
2017-08-03 18:23:43 +00:00
|
|
|
|
|
|
|
import com.android.build.OutputFile
|
|
|
|
|
|
|
|
/**
|
2023-05-18 21:09:33 +00:00
|
|
|
* This is the configuration block to customize your React Native Android app.
|
|
|
|
* By default you don't need to apply any configuration, just uncomment the lines you need.
|
2017-08-03 18:23:43 +00:00
|
|
|
*/
|
2023-05-18 21:09:33 +00:00
|
|
|
react {
|
|
|
|
/* Folders */
|
|
|
|
// The root of your project, i.e. where "package.json" lives. Default is '..'
|
|
|
|
// root = file("../")
|
|
|
|
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
|
|
|
|
// reactNativeDir = file("../node_modules/react-native")
|
|
|
|
// The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
|
|
|
|
// codegenDir = file("../node_modules/react-native-codegen")
|
|
|
|
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
|
|
|
|
// cliFile = file("../node_modules/react-native/cli.js")
|
|
|
|
/* Variants */
|
|
|
|
// The list of variants to that are debuggable. For those we're going to
|
|
|
|
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
|
|
|
|
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
|
|
|
debuggableVariants = ["experimentalPlayDebug", "officialPlayDebug", "experimentalFossDebug", "officialFossDebug"]
|
|
|
|
/* Bundling */
|
|
|
|
// A list containing the node command and its flags. Default is just 'node'.
|
|
|
|
// nodeExecutableAndArgs = ["node"]
|
|
|
|
//
|
|
|
|
// The command to run when bundling. By default is 'bundle'
|
|
|
|
// bundleCommand = "ram-bundle"
|
|
|
|
//
|
|
|
|
// The path to the CLI configuration file. Default is empty.
|
|
|
|
// bundleConfig = file(../rn-cli.config.js)
|
|
|
|
//
|
|
|
|
// The name of the generated asset file containing your JS bundle
|
|
|
|
// bundleAssetName = "MyApplication.android.bundle"
|
|
|
|
//
|
|
|
|
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
|
|
|
|
// entryFile = file("../js/MyApplication.android.js")
|
|
|
|
//
|
|
|
|
// A list of extra flags to pass to the 'bundle' commands.
|
|
|
|
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
|
|
|
|
// extraPackagerArgs = []
|
|
|
|
/* Hermes Commands */
|
|
|
|
// The hermes compiler command to run. By default it is 'hermesc'
|
|
|
|
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
|
|
|
|
//
|
|
|
|
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
|
|
|
|
// hermesFlags = ["-O", "-output-source-map"]
|
|
|
|
}
|
2017-08-03 18:23:43 +00:00
|
|
|
|
2018-08-01 19:35:06 +00:00
|
|
|
|
2023-05-18 21:09:33 +00:00
|
|
|
// project.ext.react = [
|
|
|
|
// bundleAssetName: "app.bundle",
|
|
|
|
// iconFontNames: [ 'custom.ttf' ],
|
|
|
|
// enableHermes: true, // clean and rebuild if changing
|
|
|
|
// ]
|
2017-08-03 18:23:43 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-18 21:09:33 +00:00
|
|
|
* Set this to true to create four separate APKs instead of one,
|
|
|
|
* one for each native architecture. This is useful if you don't
|
|
|
|
* use App Bundles (https://developer.android.com/guide/app-bundle/)
|
|
|
|
* and want to have separate APKs to upload to the Play Store.
|
2017-08-03 18:23:43 +00:00
|
|
|
*/
|
2018-04-27 04:09:16 +00:00
|
|
|
def enableSeparateBuildPerCPUArchitecture = false
|
2017-08-03 18:23:43 +00:00
|
|
|
|
|
|
|
/**
|
2023-05-18 21:09:33 +00:00
|
|
|
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
|
2017-08-03 18:23:43 +00:00
|
|
|
*/
|
2018-04-27 04:09:16 +00:00
|
|
|
def enableProguardInReleaseBuilds = false
|
2017-08-03 18:23:43 +00:00
|
|
|
|
2019-08-07 13:51:34 +00:00
|
|
|
/**
|
2023-05-18 21:09:33 +00:00
|
|
|
* The preferred build flavor of JavaScriptCore (JSC)
|
2019-08-07 13:51:34 +00:00
|
|
|
*
|
|
|
|
* For example, to use the international variant, you can use:
|
|
|
|
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
|
|
|
|
*
|
|
|
|
* The international variant includes ICU i18n library and necessary data
|
|
|
|
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
2023-05-18 21:09:33 +00:00
|
|
|
* give correct results when using with locales other than en-US. Note that
|
2019-08-07 13:51:34 +00:00
|
|
|
* this variant is about 6MiB larger per architecture than default.
|
|
|
|
*/
|
|
|
|
def jscFlavor = 'org.webkit:android-jsc:+'
|
|
|
|
|
2022-08-08 21:02:08 +00:00
|
|
|
/**
|
2023-05-18 21:09:33 +00:00
|
|
|
* Private function to get the list of Native Architectures you want to build.
|
|
|
|
* This reads the value from reactNativeArchitectures in your gradle.properties
|
|
|
|
* file and works together with the --active-arch-only flag of react-native run-android.
|
2022-08-08 21:02:08 +00:00
|
|
|
*/
|
|
|
|
def reactNativeArchitectures() {
|
|
|
|
def value = project.getProperties().get("reactNativeArchitectures")
|
|
|
|
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
|
|
}
|
|
|
|
|
2017-08-03 18:23:43 +00:00
|
|
|
android {
|
2022-08-08 21:02:08 +00:00
|
|
|
ndkVersion rootProject.ext.ndkVersion
|
2019-05-22 20:15:35 +00:00
|
|
|
compileSdkVersion rootProject.ext.compileSdkVersion
|
|
|
|
|
2023-05-18 21:09:33 +00:00
|
|
|
// Can't set this, since it causes issues to Official flavor
|
|
|
|
// namespace APPLICATION_ID
|
2017-08-03 18:23:43 +00:00
|
|
|
defaultConfig {
|
2020-12-04 16:17:29 +00:00
|
|
|
applicationId APPLICATION_ID
|
2019-05-22 20:15:35 +00:00
|
|
|
minSdkVersion rootProject.ext.minSdkVersion
|
|
|
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
2017-11-07 16:58:33 +00:00
|
|
|
versionCode VERSIONCODE as Integer
|
2023-06-20 19:19:14 +00:00
|
|
|
versionName "4.40.0"
|
2018-07-17 19:10:27 +00:00
|
|
|
vectorDrawables.useSupportLibrary = true
|
2020-12-14 16:20:32 +00:00
|
|
|
if (!isFoss) {
|
2020-08-24 12:24:10 +00:00
|
|
|
manifestPlaceholders = [BugsnagAPIKey: BugsnagAPIKey as String]
|
2020-11-09 20:14:35 +00:00
|
|
|
missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60" // See note below!
|
2020-08-24 12:24:10 +00:00
|
|
|
}
|
2020-11-12 16:06:48 +00:00
|
|
|
resValue "string", "rn_config_reader_custom_package", "chat.rocket.reactnative"
|
2021-12-02 13:19:15 +00:00
|
|
|
testBuildType System.getProperty('testBuildType', 'debug')
|
|
|
|
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
2022-08-08 21:02:08 +00:00
|
|
|
}
|
|
|
|
|
2023-05-18 21:09:33 +00:00
|
|
|
splits {
|
|
|
|
abi {
|
|
|
|
reset()
|
|
|
|
enable enableSeparateBuildPerCPUArchitecture
|
|
|
|
universalApk false // If true, also generate a universal APK
|
|
|
|
include (*reactNativeArchitectures())
|
2022-08-08 21:02:08 +00:00
|
|
|
}
|
2017-08-03 18:23:43 +00:00
|
|
|
}
|
2017-08-15 13:21:20 +00:00
|
|
|
signingConfigs {
|
|
|
|
release {
|
2017-11-06 23:45:48 +00:00
|
|
|
if (project.hasProperty('KEYSTORE')) {
|
|
|
|
storeFile file(KEYSTORE)
|
|
|
|
storePassword KEYSTORE_PASSWORD
|
|
|
|
keyAlias KEY_ALIAS
|
|
|
|
keyPassword KEY_PASSWORD
|
2017-08-15 13:21:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-08-03 18:23:43 +00:00
|
|
|
buildTypes {
|
|
|
|
release {
|
2018-04-24 19:34:03 +00:00
|
|
|
minifyEnabled enableProguardInReleaseBuilds
|
|
|
|
setProguardFiles([getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'])
|
2023-03-07 12:28:51 +00:00
|
|
|
proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
|
2018-04-27 04:09:16 +00:00
|
|
|
signingConfig signingConfigs.release
|
2020-12-14 16:20:32 +00:00
|
|
|
if (!isFoss) {
|
2020-08-24 12:24:10 +00:00
|
|
|
firebaseCrashlytics {
|
|
|
|
nativeSymbolUploadEnabled true
|
2022-08-08 21:02:08 +00:00
|
|
|
strippedNativeLibsDir 'build/intermediates/stripped_native_libs/release/out/lib'
|
|
|
|
unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib'
|
2020-08-24 12:24:10 +00:00
|
|
|
}
|
2020-07-24 13:19:17 +00:00
|
|
|
}
|
2018-04-27 04:09:16 +00:00
|
|
|
}
|
2017-08-03 18:23:43 +00:00
|
|
|
}
|
2020-05-08 16:37:49 +00:00
|
|
|
|
2017-08-03 18:23:43 +00:00
|
|
|
// applicationVariants are e.g. debug, release
|
2020-08-24 12:24:10 +00:00
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
flavorDimensions "app", "type"
|
2020-08-24 12:24:10 +00:00
|
|
|
productFlavors {
|
2020-12-14 16:20:32 +00:00
|
|
|
official {
|
|
|
|
dimension = "app"
|
|
|
|
buildConfigField "boolean", "IS_OFFICIAL", "true"
|
|
|
|
}
|
|
|
|
experimental {
|
|
|
|
dimension = "app"
|
|
|
|
buildConfigField "boolean", "IS_OFFICIAL", "false"
|
|
|
|
}
|
2020-08-24 12:24:10 +00:00
|
|
|
foss {
|
|
|
|
dimension = "type"
|
|
|
|
buildConfigField "boolean", "FDROID_BUILD", "true"
|
|
|
|
}
|
|
|
|
play {
|
|
|
|
dimension = "type"
|
|
|
|
buildConfigField "boolean", "FDROID_BUILD", "false"
|
|
|
|
}
|
|
|
|
}
|
2020-11-09 20:14:35 +00:00
|
|
|
sourceSets {
|
2020-12-14 16:20:32 +00:00
|
|
|
// TODO: refactor making sure notifications are working properly both on debug and release
|
|
|
|
experimentalPlayDebug {
|
|
|
|
java.srcDirs = ['src/main/java', 'src/play/java']
|
|
|
|
manifest.srcFile 'src/play/AndroidManifest.xml'
|
|
|
|
}
|
|
|
|
experimentalPlayRelease {
|
|
|
|
java.srcDirs = ['src/main/java', 'src/play/java']
|
|
|
|
manifest.srcFile 'src/play/AndroidManifest.xml'
|
|
|
|
}
|
|
|
|
officialPlayDebug {
|
2020-11-09 20:14:35 +00:00
|
|
|
java.srcDirs = ['src/main/java', 'src/play/java']
|
|
|
|
manifest.srcFile 'src/play/AndroidManifest.xml'
|
|
|
|
}
|
2020-12-14 16:20:32 +00:00
|
|
|
officialPlayRelease {
|
2020-11-09 20:14:35 +00:00
|
|
|
java.srcDirs = ['src/main/java', 'src/play/java']
|
|
|
|
manifest.srcFile 'src/play/AndroidManifest.xml'
|
|
|
|
}
|
|
|
|
}
|
2020-08-24 12:24:10 +00:00
|
|
|
|
2017-08-03 18:23:43 +00:00
|
|
|
applicationVariants.all { variant ->
|
|
|
|
variant.outputs.each { output ->
|
|
|
|
// For each separate APK per architecture, set a unique version code as described here:
|
2019-08-07 13:51:34 +00:00
|
|
|
// https://developer.android.com/studio/build/configure-apk-splits.html
|
|
|
|
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
|
2017-08-03 18:23:43 +00:00
|
|
|
def abi = output.getFilter(OutputFile.ABI)
|
|
|
|
if (abi != null) { // null for the universal-debug, universal-release variants
|
|
|
|
output.versionCodeOverride =
|
|
|
|
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-05-23 18:44:33 +00:00
|
|
|
|
|
|
|
bundle {
|
|
|
|
language {
|
|
|
|
enableSplit = false
|
|
|
|
}
|
|
|
|
density {
|
|
|
|
enableSplit = true
|
|
|
|
}
|
|
|
|
abi {
|
|
|
|
enableSplit = true
|
|
|
|
}
|
|
|
|
}
|
2017-08-03 18:23:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2023-05-18 21:09:33 +00:00
|
|
|
// The version of react-native is set by the React Native Gradle Plugin
|
|
|
|
implementation("com.facebook.react:react-android")
|
2022-08-08 21:02:08 +00:00
|
|
|
|
2023-05-18 21:09:33 +00:00
|
|
|
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
|
|
|
|
|
|
|
|
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
|
2020-05-08 16:37:49 +00:00
|
|
|
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
|
2022-08-08 21:02:08 +00:00
|
|
|
exclude group:'com.squareup.okhttp3', module:'okhttp'
|
2020-05-08 16:37:49 +00:00
|
|
|
}
|
2019-08-07 13:51:34 +00:00
|
|
|
|
2023-05-18 21:09:33 +00:00
|
|
|
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
|
|
|
|
if (hermesEnabled.toBoolean()) {
|
|
|
|
implementation("com.facebook.react:hermes-android")
|
2019-08-07 13:51:34 +00:00
|
|
|
} else {
|
2023-05-18 21:09:33 +00:00
|
|
|
implementation jscFlavor
|
2019-08-07 13:51:34 +00:00
|
|
|
}
|
2019-12-17 16:27:13 +00:00
|
|
|
|
2023-05-18 21:09:33 +00:00
|
|
|
implementation project(':@react-native-community_viewpager')
|
|
|
|
implementation "androidx.core:core-splashscreen:1.0.0"
|
|
|
|
playImplementation project(':react-native-notifications')
|
|
|
|
|
|
|
|
playImplementation 'com.google.firebase:firebase-core:16.0.0'
|
|
|
|
playImplementation project(':@react-native-firebase_app')
|
|
|
|
playImplementation project(':@react-native-firebase_analytics')
|
|
|
|
playImplementation project(':@react-native-firebase_crashlytics')
|
|
|
|
|
2022-08-08 21:02:08 +00:00
|
|
|
implementation "com.google.code.gson:gson:2.8.9"
|
2019-12-17 16:27:13 +00:00
|
|
|
implementation "com.github.bumptech.glide:glide:4.9.0"
|
|
|
|
annotationProcessor "com.github.bumptech.glide:compiler:4.9.0"
|
2022-08-08 21:02:08 +00:00
|
|
|
implementation "com.tencent:mmkv-static:1.2.10"
|
2023-03-07 12:28:51 +00:00
|
|
|
androidTestImplementation('com.wix:detox:+')
|
2023-05-18 21:09:33 +00:00
|
|
|
androidTestImplementation 'androidx.test:core:1.4.0'
|
2023-03-07 12:28:51 +00:00
|
|
|
implementation 'androidx.appcompat:appcompat:1.1.0'
|
|
|
|
implementation 'com.facebook.soloader:soloader:0.10.4'
|
2017-08-03 18:23:43 +00:00
|
|
|
}
|
|
|
|
|
2020-08-24 12:24:10 +00:00
|
|
|
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
2020-12-14 16:20:32 +00:00
|
|
|
if (!isFoss) {
|
2020-08-24 12:24:10 +00:00
|
|
|
apply plugin: 'com.google.gms.google-services'
|
|
|
|
}
|
2022-08-08 21:02:08 +00:00
|
|
|
|
2023-05-18 21:09:33 +00:00
|
|
|
bugsnag {
|
|
|
|
uploadReactNativeMappings = false
|
|
|
|
}
|