xref: /MusicFree/android/app/build.gradle (revision 213b6edb3f145274a506fc18582f5b66286568e2)
1apply plugin: "com.android.application"
2apply plugin: "org.jetbrains.kotlin.android"
3apply plugin: "com.facebook.react"
4
5import com.android.build.OutputFile
6import groovy.json.JsonSlurper
7
8
9/**
10 * This is the configuration block to customize your React Native Android app.
11 * By default you don't need to apply any configuration, just uncomment the lines you need.
12 */
13react {
14    /* Folders */
15    //   The root of your project, i.e. where "package.json" lives. Default is '..'
16    // root = file("../")
17    //   The folder where the react-native NPM package is. Default is ../node_modules/react-native
18    // reactNativeDir = file("../node_modules/react-native")
19    //   The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
20    // codegenDir = file("../node_modules/@react-native/codegen")
21    //   The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
22    // cliFile = file("../node_modules/react-native/cli.js")
23
24    /* Variants */
25    //   The list of variants to that are debuggable. For those we're going to
26    //   skip the bundling of the JS bundle and the assets. By default is just 'debug'.
27    //   If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
28    // debuggableVariants = ["liteDebug", "prodDebug"]
29
30    /* Bundling */
31    //   A list containing the node command and its flags. Default is just 'node'.
32    // nodeExecutableAndArgs = ["node"]
33    //
34    //   The command to run when bundling. By default is 'bundle'
35    // bundleCommand = "ram-bundle"
36    //
37    //   The path to the CLI configuration file. Default is empty.
38    // bundleConfig = file(../rn-cli.config.js)
39    //
40    //   The name of the generated asset file containing your JS bundle
41    // bundleAssetName = "MyApplication.android.bundle"
42    //
43    //   The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
44    // entryFile = file("../js/MyApplication.android.js")
45    //
46    //   A list of extra flags to pass to the 'bundle' commands.
47    //   See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
48    // extraPackagerArgs = []
49
50    /* Hermes Commands */
51    //   The hermes compiler command to run. By default it is 'hermesc'
52    // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
53    //
54    //   The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
55    // hermesFlags = ["-O", "-output-source-map"]
56    //
57    // Added by install-expo-modules
58    entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", rootDir.getAbsoluteFile().getParentFile().getAbsolutePath(), "android", "absolute"].execute(null, rootDir).text.trim())
59    cliFile = new File(["node", "--print", "require.resolve('@expo/cli')"].execute(null, rootDir).text.trim())
60    bundleCommand = "export:embed"
61}
62
63/**
64 * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
65 */
66def enableProguardInReleaseBuilds = false
67
68/**
69 * The preferred build flavor of JavaScriptCore (JSC)
70 *
71 * For example, to use the international variant, you can use:
72 * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
73 *
74 * The international variant includes ICU i18n library and necessary data
75 * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
76 * give correct results when using with locales other than en-US. Note that
77 * this variant is about 6MiB larger per architecture than default.
78 */
79def jscFlavor = 'org.webkit:android-jsc:+'
80
81// !! Add lines
82def keystoreProperties = new Properties()
83def keystorePropertiesFile = rootProject.file('keystore.properties')
84if (keystorePropertiesFile.exists()) {
85    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
86}
87
88static def getVersion() {
89    def inputFile = new File("../package.json")
90    def packageJson = new JsonSlurper().parseText(inputFile.text)
91    return packageJson["version"]
92}
93
94// static def versionStringToCode(String version) {
95//     def parts = version.split('\\.')
96//     def versionCode = 0
97//     def multiplier = 1000000
98//
99//     parts.each { part ->
100//         versionCode += part.toInteger() * multiplier
101//         multiplier /= 1000
102//     }
103//
104//     return versionCode.intValue()
105// }
106
107def appVersion = getVersion()
108def appVersionCode = 400011
109
110
111android {
112    ndkVersion rootProject.ext.ndkVersion
113    buildToolsVersion rootProject.ext.buildToolsVersion
114    compileSdk rootProject.ext.compileSdkVersion
115
116    namespace "fun.upup.musicfree"
117
118    defaultConfig {
119        applicationId "fun.upup.musicfree"
120        minSdkVersion rootProject.ext.minSdkVersion
121        targetSdkVersion rootProject.ext.targetSdkVersion
122        versionCode appVersionCode
123        versionName appVersion
124    }
125    signingConfigs {
126        debug {
127            storeFile file('debug.keystore')
128            storePassword 'android'
129            keyAlias 'androiddebugkey'
130            keyPassword 'android'
131        }
132        // !! Add lines
133         release {
134            storeFile file(keystoreProperties['RELEASE_STORE_FILE'])
135            storePassword keystoreProperties['RELEASE_STORE_PASSWORD']
136            keyAlias keystoreProperties['RELEASE_KEY_ALIAS']
137            keyPassword keystoreProperties['RELEASE_KEY_PASSWORD']
138        }
139    }
140    splits {
141            abi {
142                reset()
143                enable true
144                universalApk true
145                include "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
146            }
147    }
148
149
150
151    buildTypes {
152        debug {
153            signingConfig signingConfigs.debug
154        }
155        release {
156            // Caution! In production, you need to generate your own keystore file.
157            // see https://reactnative.dev/docs/signed-apk-android.
158            signingConfig signingConfigs.release
159            minifyEnabled enableProguardInReleaseBuilds
160            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
161        }
162    }
163}
164
165dependencies {
166    // The version of react-native is set by the React Native Gradle Plugin
167    implementation("com.facebook.react:react-android")
168
169    if (hermesEnabled.toBoolean()) {
170        implementation("com.facebook.react:hermes-android")
171    } else {
172        implementation jscFlavor
173    }
174
175    // !! Add lines
176    implementation project(':react-native-fs')
177    implementation 'com.facebook.fresco:animated-gif:2.5.0'
178    // https://mvnrepository.com/artifact/net.jthink/jaudiotagger
179    implementation 'net.jthink:jaudiotagger:2.2.5'
180}
181
182apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
183