1bf6e62f2S猫头猫apply plugin: "com.android.application" 25589cdf3S猫头猫apply plugin: "org.jetbrains.kotlin.android" 35589cdf3S猫头猫apply plugin: "com.facebook.react" 4bf6e62f2S猫头猫 5bf6e62f2S猫头猫import com.android.build.OutputFile 6cf2d630eS猫头猫import groovy.json.JsonSlurper 7bf6e62f2S猫头猫 85589cdf3S猫头猫 9bf6e62f2S猫头猫/** 105589cdf3S猫头猫 * This is the configuration block to customize your React Native Android app. 115589cdf3S猫头猫 * By default you don't need to apply any configuration, just uncomment the lines you need. 12bf6e62f2S猫头猫 */ 135589cdf3S猫头猫react { 145589cdf3S猫头猫 /* Folders */ 155589cdf3S猫头猫 // The root of your project, i.e. where "package.json" lives. Default is '..' 165589cdf3S猫头猫 // root = file("../") 175589cdf3S猫头猫 // The folder where the react-native NPM package is. Default is ../node_modules/react-native 185589cdf3S猫头猫 // reactNativeDir = file("../node_modules/react-native") 195589cdf3S猫头猫 // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen 205589cdf3S猫头猫 // codegenDir = file("../node_modules/@react-native/codegen") 215589cdf3S猫头猫 // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js 225589cdf3S猫头猫 // cliFile = file("../node_modules/react-native/cli.js") 23bf6e62f2S猫头猫 245589cdf3S猫头猫 /* Variants */ 255589cdf3S猫头猫 // The list of variants to that are debuggable. For those we're going to 265589cdf3S猫头猫 // skip the bundling of the JS bundle and the assets. By default is just 'debug'. 275589cdf3S猫头猫 // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. 285589cdf3S猫头猫 // debuggableVariants = ["liteDebug", "prodDebug"] 29bf6e62f2S猫头猫 305589cdf3S猫头猫 /* Bundling */ 315589cdf3S猫头猫 // A list containing the node command and its flags. Default is just 'node'. 325589cdf3S猫头猫 // nodeExecutableAndArgs = ["node"] 335589cdf3S猫头猫 // 345589cdf3S猫头猫 // The command to run when bundling. By default is 'bundle' 355589cdf3S猫头猫 // bundleCommand = "ram-bundle" 365589cdf3S猫头猫 // 375589cdf3S猫头猫 // The path to the CLI configuration file. Default is empty. 385589cdf3S猫头猫 // bundleConfig = file(../rn-cli.config.js) 395589cdf3S猫头猫 // 405589cdf3S猫头猫 // The name of the generated asset file containing your JS bundle 415589cdf3S猫头猫 // bundleAssetName = "MyApplication.android.bundle" 425589cdf3S猫头猫 // 435589cdf3S猫头猫 // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' 445589cdf3S猫头猫 // entryFile = file("../js/MyApplication.android.js") 455589cdf3S猫头猫 // 465589cdf3S猫头猫 // A list of extra flags to pass to the 'bundle' commands. 475589cdf3S猫头猫 // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle 485589cdf3S猫头猫 // extraPackagerArgs = [] 495589cdf3S猫头猫 505589cdf3S猫头猫 /* Hermes Commands */ 515589cdf3S猫头猫 // The hermes compiler command to run. By default it is 'hermesc' 525589cdf3S猫头猫 // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" 535589cdf3S猫头猫 // 545589cdf3S猫头猫 // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" 555589cdf3S猫头猫 // hermesFlags = ["-O", "-output-source-map"] 565589cdf3S猫头猫 // 575589cdf3S猫头猫 // Added by install-expo-modules 585589cdf3S猫头猫 entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", rootDir.getAbsoluteFile().getParentFile().getAbsolutePath(), "android", "absolute"].execute(null, rootDir).text.trim()) 595589cdf3S猫头猫 cliFile = new File(["node", "--print", "require.resolve('@expo/cli')"].execute(null, rootDir).text.trim()) 605589cdf3S猫头猫 bundleCommand = "export:embed" 615589cdf3S猫头猫} 62bf6e62f2S猫头猫 63bf6e62f2S猫头猫/** 645589cdf3S猫头猫 * Set this to true to Run Proguard on Release builds to minify the Java bytecode. 65bf6e62f2S猫头猫 */ 66bf6e62f2S猫头猫def enableProguardInReleaseBuilds = false 67bf6e62f2S猫头猫 68bf6e62f2S猫头猫/** 695589cdf3S猫头猫 * 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猫头猫 815589cdf3S猫头猫// !! 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猫头猫 885589cdf3S猫头猫static def getVersion() { 89cf2d630eS猫头猫 def inputFile = new File("../package.json") 90cf2d630eS猫头猫 def packageJson = new JsonSlurper().parseText(inputFile.text) 91cf2d630eS猫头猫 return packageJson["version"] 92cf2d630eS猫头猫} 93cf2d630eS猫头猫 94*e9e7efbbS猫头猫// static def versionStringToCode(String version) { 95*e9e7efbbS猫头猫// def parts = version.split('\\.') 96*e9e7efbbS猫头猫// def versionCode = 0 97*e9e7efbbS猫头猫// def multiplier = 1000000 98*e9e7efbbS猫头猫// 99*e9e7efbbS猫头猫// parts.each { part -> 100*e9e7efbbS猫头猫// versionCode += part.toInteger() * multiplier 101*e9e7efbbS猫头猫// multiplier /= 1000 102*e9e7efbbS猫头猫// } 103*e9e7efbbS猫头猫// 104*e9e7efbbS猫头猫// return versionCode.intValue() 105*e9e7efbbS猫头猫// } 10617958235S猫头猫 107cf2d630eS猫头猫def appVersion = getVersion() 108*e9e7efbbS猫头猫def appVersionCode = 400011 10917958235S猫头猫 110cf2d630eS猫头猫 111bf6e62f2S猫头猫android { 112bf6e62f2S猫头猫 ndkVersion rootProject.ext.ndkVersion 1135589cdf3S猫头猫 buildToolsVersion rootProject.ext.buildToolsVersion 1145589cdf3S猫头猫 compileSdk rootProject.ext.compileSdkVersion 115bf6e62f2S猫头猫 1165589cdf3S猫头猫 namespace "fun.upup.musicfree" 11717958235S猫头猫 118bf6e62f2S猫头猫 defaultConfig { 119bf6e62f2S猫头猫 applicationId "fun.upup.musicfree" 120bf6e62f2S猫头猫 minSdkVersion rootProject.ext.minSdkVersion 121bf6e62f2S猫头猫 targetSdkVersion rootProject.ext.targetSdkVersion 12217958235S猫头猫 versionCode appVersionCode 123cf2d630eS猫头猫 versionName appVersion 124bf6e62f2S猫头猫 } 125bf6e62f2S猫头猫 signingConfigs { 126bf6e62f2S猫头猫 debug { 127bf6e62f2S猫头猫 storeFile file('debug.keystore') 128bf6e62f2S猫头猫 storePassword 'android' 129bf6e62f2S猫头猫 keyAlias 'androiddebugkey' 130bf6e62f2S猫头猫 keyPassword 'android' 131bf6e62f2S猫头猫 } 1325589cdf3S猫头猫 // !! Add lines 133bf6e62f2S猫头猫 release { 134bf6e62f2S猫头猫 storeFile file(keystoreProperties['RELEASE_STORE_FILE']) 135bf6e62f2S猫头猫 storePassword keystoreProperties['RELEASE_STORE_PASSWORD'] 136bf6e62f2S猫头猫 keyAlias keystoreProperties['RELEASE_KEY_ALIAS'] 137bf6e62f2S猫头猫 keyPassword keystoreProperties['RELEASE_KEY_PASSWORD'] 138bf6e62f2S猫头猫 } 139bf6e62f2S猫头猫 } 14017958235S猫头猫 splits { 14117958235S猫头猫 abi { 14217958235S猫头猫 reset() 14317958235S猫头猫 enable true 14417958235S猫头猫 universalApk true 14517958235S猫头猫 include "armeabi-v7a", "arm64-v8a", "x86", "x86_64" 14617958235S猫头猫 } 14717958235S猫头猫 } 14817958235S猫头猫 14917958235S猫头猫 15017958235S猫头猫 151bf6e62f2S猫头猫 buildTypes { 152bf6e62f2S猫头猫 debug { 153bf6e62f2S猫头猫 signingConfig signingConfigs.debug 154bf6e62f2S猫头猫 } 155bf6e62f2S猫头猫 release { 156bf6e62f2S猫头猫 // Caution! In production, you need to generate your own keystore file. 157bf6e62f2S猫头猫 // see https://reactnative.dev/docs/signed-apk-android. 158bf6e62f2S猫头猫 signingConfig signingConfigs.release 159bf6e62f2S猫头猫 minifyEnabled enableProguardInReleaseBuilds 160bf6e62f2S猫头猫 proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 161bf6e62f2S猫头猫 } 162bf6e62f2S猫头猫 } 163bf6e62f2S猫头猫} 164bf6e62f2S猫头猫 165bf6e62f2S猫头猫dependencies { 1665589cdf3S猫头猫 // The version of react-native is set by the React Native Gradle Plugin 1675589cdf3S猫头猫 implementation("com.facebook.react:react-android") 168bf6e62f2S猫头猫 1695589cdf3S猫头猫 if (hermesEnabled.toBoolean()) { 1705589cdf3S猫头猫 implementation("com.facebook.react:hermes-android") 171bf6e62f2S猫头猫 } else { 172bf6e62f2S猫头猫 implementation jscFlavor 173bf6e62f2S猫头猫 } 174bf6e62f2S猫头猫 1755589cdf3S猫头猫 // !! Add lines 176bf6e62f2S猫头猫 implementation project(':react-native-fs') 177ed9fd4ceS猫头猫 implementation 'com.facebook.fresco:animated-gif:2.5.0' 1787993f90eS猫头猫 // https://mvnrepository.com/artifact/net.jthink/jaudiotagger 1797993f90eS猫头猫 implementation 'net.jthink:jaudiotagger:2.2.5' 180bf6e62f2S猫头猫} 181bf6e62f2S猫头猫 182bf6e62f2S猫头猫apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 183