fix apk path building

This commit is contained in:
Vologhat
2023-06-27 17:32:28 +03:00
parent ea0a0f1d93
commit 409279eca0
+17 -11
View File
@@ -52,22 +52,25 @@ android {
} }
buildTypes { buildTypes {
dev { base {
initWith release
buildConfigField 'String', 'APPCENTER_KEY', '""' buildConfigField 'String', 'APPCENTER_KEY', '""'
} }
beta { debug {
initWith release initWith base
buildConfigField 'String', 'APPCENTER_KEY', '""' minifyEnabled false
} }
release { release {
buildConfigField 'String', 'APPCENTER_KEY', '""' initWith base
minifyEnabled true minifyEnabled true
proguardFile 'proguard-rules.pro' proguardFile 'proguard-rules.pro'
} }
debug { dev {
buildConfigField 'String', 'APPCENTER_KEY', '""' initWith debug
minifyEnabled false //etc
}
beta {
initWith release
//etc
} }
} }
@@ -98,13 +101,16 @@ task generateBuildTasks() {
android.applicationVariants.all { variant -> android.applicationVariants.all { variant ->
variant.outputs.each { output -> variant.outputs.each { output ->
def buildType = output.name.toString().capitalize() def buildType = output.name.toString().capitalize()
if(buildType=="Base")return
task "exportDex$buildType"() { task "exportDex$buildType"() {
dependsOn('assemble' + buildType) dependsOn('assemble' + buildType)
doLast { doLast {
try { try {
def suffix=buildType.toLowerCase() def suffix=buildType.toLowerCase()
def zip=new ZipFile(new File(projectDir,"/build/outputs/apk/$suffix/app-$suffix${suffix!="debug"?"-unsigned.apk":".apk"}")) String apkPath=projectDir.getAbsolutePath()+"/build/outputs/apk/$suffix/app-$suffix"
def apk=new File(apkPath+"-unsigned.apk")
if(!apk.exists())apk=new File(apkPath+".apk")
def zip=new ZipFile(apk)
def entries=zip.entries() def entries=zip.entries()
def dexCounter=dexes def dexCounter=dexes
while(entries.hasMoreElements()) while(entries.hasMoreElements())