|
| 1 | +apply plugin: "com.android.application" |
| 2 | +apply plugin: "org.jetbrains.kotlin.android" |
| 3 | +apply plugin: "com.facebook.react" |
| 4 | + |
| 5 | +apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" |
| 6 | + |
| 7 | +/** |
| 8 | + * This is the configuration block to customize your React Native Android app. |
| 9 | + * By default you don't need to apply any configuration, just uncomment the lines you need. |
| 10 | + */ |
| 11 | +react { |
| 12 | + /* Folders */ |
| 13 | + // The root of your project, i.e. where "package.json" lives. Default is '..' |
| 14 | + // root = file("../") |
| 15 | + // The folder where the react-native NPM package is. Default is ../node_modules/react-native |
| 16 | + // reactNativeDir = file("../node_modules/react-native") |
| 17 | + // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen |
| 18 | + // codegenDir = file("../node_modules/@react-native/codegen") |
| 19 | + // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js |
| 20 | + // cliFile = file("../node_modules/react-native/cli.js") |
| 21 | + |
| 22 | + /* Variants */ |
| 23 | + // The list of variants to that are debuggable. For those we're going to |
| 24 | + // skip the bundling of the JS bundle and the assets. By default is just 'debug'. |
| 25 | + // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. |
| 26 | + // debuggableVariants = ["liteDebug", "prodDebug"] |
| 27 | + |
| 28 | + /* Bundling */ |
| 29 | + // A list containing the node command and its flags. Default is just 'node'. |
| 30 | + // nodeExecutableAndArgs = ["node"] |
| 31 | + // |
| 32 | + // The command to run when bundling. By default is 'bundle' |
| 33 | + // bundleCommand = "ram-bundle" |
| 34 | + // |
| 35 | + // The path to the CLI configuration file. Default is empty. |
| 36 | + // bundleConfig = file(../rn-cli.config.js) |
| 37 | + // |
| 38 | + // The name of the generated asset file containing your JS bundle |
| 39 | + // bundleAssetName = "MyApplication.android.bundle" |
| 40 | + // |
| 41 | + // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' |
| 42 | + // entryFile = file("../js/MyApplication.android.js") |
| 43 | + // |
| 44 | + // A list of extra flags to pass to the 'bundle' commands. |
| 45 | + // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle |
| 46 | + // extraPackagerArgs = [] |
| 47 | + |
| 48 | + /* Hermes Commands */ |
| 49 | + // The hermes compiler command to run. By default it is 'hermesc' |
| 50 | + // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" |
| 51 | + // |
| 52 | + // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" |
| 53 | + // hermesFlags = ["-O", "-output-source-map"] |
| 54 | +} |
| 55 | + |
| 56 | +/** |
| 57 | + * Set this to true to Run Proguard on Release builds to minify the Java bytecode. |
| 58 | + */ |
| 59 | +def enableProguardInReleaseBuilds = false |
| 60 | + |
| 61 | +/** |
| 62 | + * The preferred build flavor of JavaScriptCore (JSC) |
| 63 | + * |
| 64 | + * For example, to use the international variant, you can use: |
| 65 | + * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` |
| 66 | + * |
| 67 | + * The international variant includes ICU i18n library and necessary data |
| 68 | + * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that |
| 69 | + * give correct results when using with locales other than en-US. Note that |
| 70 | + * this variant is about 6MiB larger per architecture than default. |
| 71 | + */ |
| 72 | +def jscFlavor = 'org.webkit:android-jsc:+' |
| 73 | + |
| 74 | +android { |
| 75 | + ndkVersion rootProject.ext.ndkVersion |
| 76 | + buildToolsVersion rootProject.ext.buildToolsVersion |
| 77 | + compileSdk rootProject.ext.compileSdkVersion |
| 78 | + |
| 79 | + namespace "com.example" |
| 80 | + defaultConfig { |
| 81 | + applicationId "com.example" |
| 82 | + minSdkVersion rootProject.ext.minSdkVersion |
| 83 | + targetSdkVersion rootProject.ext.targetSdkVersion |
| 84 | + versionCode 1 |
| 85 | + versionName "1.0" |
| 86 | + } |
| 87 | + signingConfigs { |
| 88 | + debug { |
| 89 | + storeFile file('debug.keystore') |
| 90 | + storePassword 'android' |
| 91 | + keyAlias 'androiddebugkey' |
| 92 | + keyPassword 'android' |
| 93 | + } |
| 94 | + } |
| 95 | + buildTypes { |
| 96 | + debug { |
| 97 | + signingConfig signingConfigs.debug |
| 98 | + } |
| 99 | + release { |
| 100 | + // Caution! In production, you need to generate your own keystore file. |
| 101 | + // see https://reactnative.dev/docs/signed-apk-android. |
| 102 | + signingConfig signingConfigs.debug |
| 103 | + minifyEnabled enableProguardInReleaseBuilds |
| 104 | + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" |
| 105 | + } |
| 106 | + } |
| 107 | +} |
| 108 | + |
| 109 | +dependencies { |
| 110 | + // The version of react-native is set by the React Native Gradle Plugin |
| 111 | + implementation("com.facebook.react:react-android") |
| 112 | + implementation project(':react-native-config') |
| 113 | + |
| 114 | + if (hermesEnabled.toBoolean()) { |
| 115 | + implementation("com.facebook.react:hermes-android") |
| 116 | + } else { |
| 117 | + implementation jscFlavor |
| 118 | + } |
| 119 | +} |
| 120 | + |
| 121 | +apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) |
0 commit comments