5
是否有任何方式從app/build.gradle文件運行gradle任務,這樣當我構建發佈APK時,任務「firebaseUploadReleaseProguardMapping」將自動運行。從app/build.gradle文件運行firebaseUploadReleaseProguardMapping
是否有任何方式從app/build.gradle文件運行gradle任務,這樣當我構建發佈APK時,任務「firebaseUploadReleaseProguardMapping」將自動運行。從app/build.gradle文件運行firebaseUploadReleaseProguardMapping
可以使用dependsOn
例如(您app/build.gradle
):
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-crash'
android {
}
dependencies {
}
task release
task archiveRelease(type: Copy) {
from './build/outputs/apk', './build/outputs/'
into "../releases/${rootProject.ext.configuration.version_code}"
include('app-release.apk', 'mapping/release/mapping.txt')
rename('app-release.apk', "${rootProject.ext.configuration.package}_${rootProject.ext.configuration.version_name}_${rootProject.ext.configuration.version_code}.apk")
}
project.afterEvaluate {
dependencyUpdates.dependsOn clean
assembleRelease.dependsOn clean
def publishApkRelease = project.tasks.getByName("publishApkRelease")
publishApkRelease.dependsOn assembleRelease
release.dependsOn publishApkRelease, firebaseUploadReleaseProguardMapping, archiveRelease
}
我創建了一個名爲release
新任務。它取決於publishApkRelease
(來自gradle-play-publisher),firebaseUploadReleaseProguardMapping
和archiveRelease
。而publishApkRelease
取決於assembleRelease
。
在ned你只需調用./gradlew release
,它會構建你的發佈版本,將apk上傳到Google play,將映射文件上傳到Firebase並存檔apk和映射文件的副本。
你有解決方法嗎? –
不,我沒有。 –