2017-05-06 16:37:28 +02:00
|
|
|
apply plugin: "com.android.application"
|
2023-06-10 18:02:58 +02:00
|
|
|
apply plugin: "com.facebook.react"
|
2017-05-06 16:37:28 +02:00
|
|
|
|
|
|
|
import com.android.build.OutputFile
|
2022-12-27 21:37:15 +02:00
|
|
|
import org.apache.tools.ant.taskdefs.condition.Os
|
2017-05-06 16:37:28 +02:00
|
|
|
|
2023-06-10 18:02:58 +02: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-05-06 16:37:28 +02:00
|
|
|
*/
|
|
|
|
|
2023-06-10 18:02:58 +02: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 = ["liteDebug", "prodDebug"]
|
|
|
|
/* Bundling */
|
|
|
|
// A list containing the node command and its flags. Default is just 'node'.
|
|
|
|
// nodeExecutableAndArgs = ["node"]
|
2023-05-09 12:01:43 +02:00
|
|
|
//
|
2023-06-10 18:02:58 +02:00
|
|
|
// The command to run when bundling. By default is 'bundle'
|
|
|
|
// bundleCommand = "ram-bundle"
|
2023-05-09 12:01:43 +02:00
|
|
|
//
|
2023-06-10 18:02:58 +02:00
|
|
|
// 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-05-06 16:37:28 +02:00
|
|
|
|
|
|
|
/**
|
2023-06-10 18:02:58 +02: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-05-06 16:37:28 +02:00
|
|
|
*/
|
2018-01-17 22:16:13 +02:00
|
|
|
def enableSeparateBuildPerCPUArchitecture = false
|
2017-05-06 16:37:28 +02:00
|
|
|
|
|
|
|
/**
|
2023-06-10 18:02:58 +02:00
|
|
|
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
|
2017-05-06 16:37:28 +02:00
|
|
|
*/
|
|
|
|
def enableProguardInReleaseBuilds = false
|
|
|
|
|
2020-02-09 19:42:19 +02:00
|
|
|
/**
|
2023-06-10 18:02:58 +02:00
|
|
|
* The preferred build flavor of JavaScriptCore (JSC)
|
2020-02-09 19:42:19 +02: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-06-10 18:02:58 +02:00
|
|
|
* give correct results when using with locales other than en-US. Note that
|
2020-02-09 19:42:19 +02:00
|
|
|
* this variant is about 6MiB larger per architecture than default.
|
|
|
|
*/
|
2021-01-07 18:29:53 +02:00
|
|
|
|
|
|
|
// We need the intl variant to support natural sorting of notes.
|
|
|
|
// https://github.com/laurent22/joplin/pull/4272
|
|
|
|
def jscFlavor = 'org.webkit:android-jsc-intl:+'
|
2020-10-16 17:26:19 +02:00
|
|
|
|
2020-02-09 19:42:19 +02:00
|
|
|
/**
|
2023-06-10 18:02:58 +02: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.
|
2021-11-02 18:33:53 +02:00
|
|
|
*/
|
2022-12-27 21:37:15 +02:00
|
|
|
def reactNativeArchitectures() {
|
|
|
|
def value = project.getProperties().get("reactNativeArchitectures")
|
|
|
|
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
|
|
}
|
2021-11-02 18:33:53 +02:00
|
|
|
|
2017-05-06 16:37:28 +02:00
|
|
|
android {
|
2023-06-10 18:02:58 +02:00
|
|
|
ndkVersion rootProject.ext.ndkVersion
|
|
|
|
|
2018-10-02 20:57:31 +02:00
|
|
|
compileSdkVersion rootProject.ext.compileSdkVersion
|
2020-08-02 14:34:09 +02:00
|
|
|
|
2019-06-14 08:12:24 +02:00
|
|
|
compileOptions {
|
2020-10-16 17:26:19 +02:00
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
|
|
}
|
2017-05-06 16:37:28 +02:00
|
|
|
|
2023-06-10 18:02:58 +02:00
|
|
|
// dexOptions {
|
|
|
|
// // To fix "GC overhead limit exceeded"
|
|
|
|
// // https://stackoverflow.com/q/32133013/561309
|
|
|
|
// javaMaxHeapSize "4g"
|
|
|
|
// }
|
2020-11-05 18:58:23 +02:00
|
|
|
|
2023-06-10 18:02:58 +02:00
|
|
|
namespace "net.cozic.joplin"
|
2020-10-16 17:26:19 +02:00
|
|
|
defaultConfig {
|
|
|
|
applicationId "net.cozic.joplin"
|
2018-10-02 20:57:31 +02:00
|
|
|
minSdkVersion rootProject.ext.minSdkVersion
|
|
|
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
2023-11-30 19:56:17 +02:00
|
|
|
versionCode 2097729
|
|
|
|
versionName "2.13.9"
|
2023-08-22 15:08:03 +02:00
|
|
|
ndk {
|
|
|
|
abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
|
|
|
|
}
|
2020-10-16 17:26:19 +02:00
|
|
|
|
|
|
|
// https://github.com/react-native-community/react-native-camera/issues/2138
|
|
|
|
missingDimensionStrategy 'react-native-camera', 'general'
|
|
|
|
|
|
|
|
// Needed to fix: The number of method references in a .dex file cannot exceed 64K
|
2023-06-10 18:02:58 +02:00
|
|
|
multiDexEnabled true
|
2020-10-16 17:26:19 +02:00
|
|
|
}
|
2022-12-27 21:37:15 +02:00
|
|
|
|
2020-10-16 17:26:19 +02:00
|
|
|
splits {
|
|
|
|
abi {
|
|
|
|
reset()
|
|
|
|
enable enableSeparateBuildPerCPUArchitecture
|
|
|
|
universalApk false // If true, also generate a universal APK
|
2022-12-27 21:37:15 +02:00
|
|
|
// include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
|
|
|
|
include (*reactNativeArchitectures())
|
2020-10-16 17:26:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
signingConfigs {
|
|
|
|
debug {
|
2020-02-09 19:42:19 +02:00
|
|
|
storeFile file('debug.keystore')
|
|
|
|
storePassword 'android'
|
|
|
|
keyAlias 'androiddebugkey'
|
|
|
|
keyPassword 'android'
|
|
|
|
}
|
2017-07-06 21:48:17 +02:00
|
|
|
release {
|
|
|
|
if (project.hasProperty('JOPLIN_RELEASE_STORE_FILE')) {
|
|
|
|
storeFile file(JOPLIN_RELEASE_STORE_FILE)
|
|
|
|
storePassword JOPLIN_RELEASE_STORE_PASSWORD
|
|
|
|
keyAlias JOPLIN_RELEASE_KEY_ALIAS
|
|
|
|
keyPassword JOPLIN_RELEASE_KEY_PASSWORD
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-16 17:26:19 +02:00
|
|
|
buildTypes {
|
|
|
|
debug {
|
2020-02-09 19:42:19 +02:00
|
|
|
signingConfig signingConfigs.debug
|
|
|
|
}
|
2020-10-16 17:26:19 +02:00
|
|
|
release {
|
|
|
|
// Caution! In production, you need to generate your own keystore file.
|
|
|
|
// see https://reactnative.dev/docs/signed-apk-android.
|
2020-10-16 19:30:58 +02:00
|
|
|
signingConfig signingConfigs.release
|
2020-10-16 17:26:19 +02:00
|
|
|
minifyEnabled enableProguardInReleaseBuilds
|
|
|
|
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// applicationVariants are e.g. debug, release
|
|
|
|
applicationVariants.all { variant ->
|
|
|
|
variant.outputs.each { output ->
|
|
|
|
// For each separate APK per architecture, set a unique version code as described here:
|
|
|
|
// https://developer.android.com/studio/build/configure-apk-splits.html
|
2021-08-09 22:45:41 +02:00
|
|
|
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
|
2020-02-09 19:42:19 +02:00
|
|
|
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
|
2020-10-16 17:26:19 +02:00
|
|
|
def abi = output.getFilter(OutputFile.ABI)
|
|
|
|
if (abi != null) { // null for the universal-debug, universal-release variants
|
|
|
|
output.versionCodeOverride =
|
2021-08-09 22:45:41 +02:00
|
|
|
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
|
2020-10-16 17:26:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2021-12-01 13:09:16 +02:00
|
|
|
|
|
|
|
// To fix this error:
|
|
|
|
//
|
|
|
|
// > Execution failed for task ':app:lintVitalRelease'
|
|
|
|
//
|
|
|
|
// https://stackoverflow.com/a/62603296/561309
|
2023-06-10 18:02:58 +02:00
|
|
|
// lintOptions {
|
|
|
|
// disable 'InvalidPackage'
|
|
|
|
// checkReleaseBuilds false
|
|
|
|
// }
|
2017-05-06 16:37:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2021-11-16 17:11:46 +02:00
|
|
|
// This removes proprietary bits to enable inclusion in F-Droid
|
|
|
|
// https://gitlab.com/fdroid/rfp/-/issues/434#note_443458711
|
|
|
|
implementation (project(':react-native-camera')){
|
|
|
|
exclude group: 'com.google.android.gms', module: 'play-services-vision'
|
|
|
|
}
|
|
|
|
|
2023-06-10 18:02:58 +02:00
|
|
|
// implementation fileTree(dir: "libs", include: ["*.jar"])
|
2020-10-16 17:26:19 +02:00
|
|
|
|
2023-06-10 18:02:58 +02:00
|
|
|
// The version of react-native is set by the React Native Gradle Plugin
|
|
|
|
implementation("com.facebook.react:react-android")
|
2020-10-16 17:26:19 +02:00
|
|
|
|
2023-06-10 18:02:58 +02:00
|
|
|
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
|
|
|
|
|
|
|
|
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
|
2020-10-16 17:26:19 +02:00
|
|
|
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
|
|
|
|
exclude group:'com.squareup.okhttp3', module:'okhttp'
|
|
|
|
}
|
|
|
|
|
2023-06-10 18:02:58 +02:00
|
|
|
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
|
|
|
|
if (hermesEnabled.toBoolean()) {
|
|
|
|
implementation("com.facebook.react:hermes-android")
|
2020-02-09 19:42:19 +02:00
|
|
|
} else {
|
2020-02-09 22:21:52 +02:00
|
|
|
implementation jscFlavor
|
2020-02-09 19:42:19 +02:00
|
|
|
}
|
|
|
|
|
2020-10-16 17:26:19 +02:00
|
|
|
// Needed to fix: The number of method references in a .dex file cannot exceed 64K
|
2023-06-10 18:02:58 +02:00
|
|
|
// implementation 'com.android.support:multidex:2.0.1'
|
2017-05-06 16:37:28 +02:00
|
|
|
}
|
2017-05-16 23:05:53 +02:00
|
|
|
|
2020-02-09 19:42:19 +02:00
|
|
|
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
2020-10-16 17:26:19 +02:00
|
|
|
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
|