import java.text.SimpleDateFormat plugins { id 'com.android.application' id 'kotlin-android' } android { signingConfigs { release { storeFile file('D:\\AndroidKeys\\yutou.jks') storePassword '34864394' keyPassword '34864394' keyAlias 'yutou' } } compileSdk 31 defaultConfig { applicationId "com.yutou.doormanager" minSdk 21 targetSdk 30 versionCode 1 versionName "1.3.1-" + new SimpleDateFormat("MMddhhmmss").format(new Date()) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" ndk { abiFilters "armeabi-v7a" } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } buildFeatures { viewBinding true } } dependencies { implementation 'androidx.core:core-ktx:1.3.2' implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'com.google.android.material:material:1.4.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.1' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation project(path: ':libWSLive') testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.3' def camerax_version = "1.1.0-beta01" implementation "androidx.camera:camera-core:${camerax_version}" implementation "androidx.camera:camera-camera2:${camerax_version}" implementation "androidx.camera:camera-lifecycle:${camerax_version}" implementation "androidx.camera:camera-video:${camerax_version}" implementation "androidx.camera:camera-view:${camerax_version}" implementation "androidx.camera:camera-extensions:${camerax_version}" implementation("com.squareup.okhttp3:okhttp:4.9.3") implementation 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1' } task buildApk(dependsOn: "assembleRelease") { doFirst { println '开始打包' } //dependsOn("assembleRelease") doLast { def files = new File("X:\\servier\\tools\\web\\apk\\door\\").listFiles() for (File file : files) { println file.name file.delete() } def keystore = file("D:\\AndroidKeys\\yutou.jks") def unsignedApk = file("build\\intermediates\\apk\\release\\app-release-unsigned.apk") def signedApk = file("X:\\servier\\tools\\web\\apk\\door\\app-release-" + android.defaultConfig.versionName + ".apk") def cmd = "jarsigner -verbose -keystore " + keystore + " -signedjar " + signedApk + " " + unsignedApk + " yutou -storepass 34864394" println cmd def pr = Runtime.getRuntime().exec("cmd /c ${cmd}") def input = new BufferedReader(new InputStreamReader(pr.getInputStream(), "GBK")) String line; while ((line = input.readLine()) != null) { println line } assert pr.waitFor() == 0 } }