plugins { id 'com.android.application' } android { namespace 'com.xixun.launcher' compileSdk 34 defaultConfig { applicationId "com.xixun.launcher" minSdk 21 targetSdk 34 versionCode 1 versionName "1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } buildFeatures { aidl true } compileOptions { sourceCompatibility JavaVersion.VERSION_11 targetCompatibility JavaVersion.VERSION_11 } } dependencies { implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.github.bumptech.glide:glide:4.11.0' implementation 'androidx.leanback:leanback:1.0.0' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.25' implementation files('libs/gnph.jar') implementation 'com.google.android.material:material:1.8.0' } def getAppName() { def stringsFile = android.sourceSets.main.res.sourceFiles.find { it.name.equals 'strings.xml' } String s = new XmlParser().parse(stringsFile).string.find { it.@name.equals 'app_name' }.text(); return s.replaceAll("\"", ""); } // 修改 Apk 名 android.applicationVariants.configureEach { variant -> variant.outputs.configureEach { def fileName = "${getAppName()}-${versionName}.apk" outputFileName = fileName } }