xref: /MusicFree/android/app/build.gradle (revision 5589cdf32b2bb0f641e5ac7bf1f6152cd6b9b70e)
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
94def appVersion = getVersion()
95
96android {
97    ndkVersion rootProject.ext.ndkVersion
98    buildToolsVersion rootProject.ext.buildToolsVersion
99    compileSdk rootProject.ext.compileSdkVersion
100
101    namespace "fun.upup.musicfree"
102    defaultConfig {
103        applicationId "fun.upup.musicfree"
104        minSdkVersion rootProject.ext.minSdkVersion
105        targetSdkVersion rootProject.ext.targetSdkVersion
106        versionCode 1
107        versionName appVersion
108    }
109    signingConfigs {
110        debug {
111            storeFile file('debug.keystore')
112            storePassword 'android'
113            keyAlias 'androiddebugkey'
114            keyPassword 'android'
115        }
116        // !! Add lines
117         release {
118            storeFile file(keystoreProperties['RELEASE_STORE_FILE'])
119            storePassword keystoreProperties['RELEASE_STORE_PASSWORD']
120            keyAlias keystoreProperties['RELEASE_KEY_ALIAS']
121            keyPassword keystoreProperties['RELEASE_KEY_PASSWORD']
122        }
123    }
124    buildTypes {
125        debug {
126            signingConfig signingConfigs.debug
127        }
128        release {
129            // Caution! In production, you need to generate your own keystore file.
130            // see https://reactnative.dev/docs/signed-apk-android.
131            signingConfig signingConfigs.release
132            minifyEnabled enableProguardInReleaseBuilds
133            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
134        }
135    }
136}
137
138dependencies {
139    // The version of react-native is set by the React Native Gradle Plugin
140    implementation("com.facebook.react:react-android")
141
142    if (hermesEnabled.toBoolean()) {
143        implementation("com.facebook.react:hermes-android")
144    } else {
145        implementation jscFlavor
146    }
147
148    // !! Add lines
149    implementation project(':react-native-fs')
150    implementation 'com.facebook.fresco:animated-gif:2.5.0'
151    // https://mvnrepository.com/artifact/net.jthink/jaudiotagger
152    implementation 'net.jthink:jaudiotagger:2.2.5'
153}
154
155apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
156