Skip to content

Commit 7999e50

Browse files
committed
fix(abi):fixed abi version
1 parent 71f4f1f commit 7999e50

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

android/app/build.gradle

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,20 @@ android {
9292
}
9393
}
9494

95+
// 使用更简单的方法来自定义文件名,避免兼容性问题
96+
applicationVariants.all { variant ->
97+
variant.outputs.all { output ->
98+
// 使用更安全的方法获取 ABI 信息
99+
def abiName = output.getFilter("ABI")
100+
def fileName = "OpenListF-v${variant.versionName}"
101+
if (abiName != null && !abiName.isEmpty()) {
102+
fileName += "_${abiName}"
103+
}
104+
fileName += ".apk"
105+
outputFileName = fileName
106+
}
107+
}
108+
95109
// kotlin {
96110
// jvmToolchain = 17
97111
// }
@@ -116,20 +130,6 @@ android {
116130
}
117131
}
118132

119-
// 使用新版 AGP 推荐的 androidComponents API 来自定义文件名
120-
androidComponents {
121-
onVariants { variant ->
122-
variant.outputs.forEach { output ->
123-
def abi = output.getFilter(com.android.build.OutputFile.ABI)
124-
if (abi != null) {
125-
output.outputFileName.set("OpenListF-v${variant.versionName}_${abi}.apk")
126-
} else {
127-
output.outputFileName.set("OpenListF-v${variant.versionName}.apk")
128-
}
129-
}
130-
}
131-
}
132-
133133
flutter {
134134
source '../..'
135135
}

0 commit comments

Comments
 (0)