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