diff --git a/V2rayNG/app/build.gradle.kts b/V2rayNG/app/build.gradle.kts index e03e1a326..9d1d87551 100644 --- a/V2rayNG/app/build.gradle.kts +++ b/V2rayNG/app/build.gradle.kts @@ -81,15 +81,19 @@ android { androidComponents { onVariants { variant -> val abiCodes = mapOf( - "universal" to 0, "arm64-v8a" to 1, "armeabi-v7a" to 2, "x86_64" to 3, "x86" to 4 + "arm64-v8a" to 1, "armeabi-v7a" to 2, "x86_64" to 3, "x86" to 4 ) val isAAB = variant.flavorName.toString() == "playstore" variant.outputs .forEach { output -> - val abi = output.filters.find { it.filterType == ABI }?.identifier ?: "universal" + val abi = output.filters.find { it.filterType == ABI }?.identifier + val baseAbiCode = abiCodes[abi] output.versionCode.set( - (output.versionCode.get() * 100 + abiCodes[abi]!! + 5000000).takeUnless { isAAB } - ?: (1000000 * 4 + output.versionCode.get()) + if (baseAbiCode != null && !isAAB ) { + (output.versionCode.get() * 100 + baseAbiCode + 5000000) + } else { + (1000000 * 4 + output.versionCode.get()) + } ) if (output is com.android.build.api.variant.impl.VariantOutputImpl) { output.outputFileName = "v2rayNG_${output.versionName.get()}_${abi}.apk"