plugins { id 'com.android.application' id 'com.google.gms.google-services' } android { compileSdkVersion 31 defaultConfig { applicationId "com.web.market" minSdkVersion 24 targetSdkVersion 31 versionCode rootProject.ext.versionCode versionName rootProject.ext.versionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } signingConfigs { debug { storeFile file('dskjweb.jks') storePassword "dskj2024" keyAlias 'dskjalias' keyPassword "dskj2024" } release { storeFile file('dskjweb.jks') storePassword "dskj2024" keyAlias 'dskjalias' keyPassword "dskj2024" } } buildTypes { release { signingConfig signingConfigs.release minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } applicationVariants.all { variant -> variant.outputs.all { def appName = "market" def outputDir = new File(rootProject.ext.outputPath) // 创建输出目录 outputDir.mkdirs() def outputFileName = "${appName}.apk" // 设置输出文件名 setOutputFileName(outputFileName) // 计算新的输出文件 def newOutputFile = new File(outputDir, outputFileName) // 如果新的输出目录不存在,则创建它 newOutputFile.parentFile.mkdirs() // 在构建完成后将 APK 复制到新位置 variant.assemble.doLast { try { java.nio.file.Files.copy( outputFile.toPath(), newOutputFile.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING ) println "Success to copy APK !!!" } catch (java.io.IOException e) { println "Failed to copy APK: ${e.message}" } } } } } dependencies { api 'androidx.appcompat:appcompat:1.1.0' api 'com.google.android.material:material:1.1.0' api 'androidx.constraintlayout:constraintlayout:1.1.3' // okhttp相关库 api 'com.squareup.okhttp3:okhttp:4.9.3' // JSON解析库 api 'com.google.code.gson:gson:2.9.0' api 'com.squareup.retrofit2:retrofit:2.5.0' api 'com.squareup.retrofit2:converter-scalars:2.3.0' api 'com.squareup.retrofit2:converter-gson:2.4.0' api 'com.squareup.retrofit2:adapter-rxjava2:2.4.0' api 'io.reactivex.rxjava2:rxjava:2.1.16' api 'io.reactivex.rxjava2:rxandroid:2.0.2' api 'com.squareup.okhttp3:logging-interceptor:3.10.0' api("com.github.bumptech.glide:glide:4.13.1") // sdk 33 api platform('com.google.firebase:firebase-bom:32.7.0') // Firebase Cloud Messaging api("com.google.firebase:firebase-messaging") }