Firebase App Distribution 找到超过 1 个此变体的输出文件
Firebase App Distribution found more than 1 output file for this variant
我正在将基于 Google document 的 "Firebase App Distribution" 添加到我的 Android 应用程序,但是在 运行 appDistributionUploadRelease
Gradle 任务之后我收到此错误留言:
10:18:03 PM: Executing task 'appDistributionUploadRelease'...
Executing tasks: [appDistributionUploadRelease] in project C:\Users\mohsenoid\development\***\***-Android
> Task :app:appDistributionUploadRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:appDistributionUploadRelease'.
> App Distribution found more than 1 output file for this variant. Please contact firebase-support@google.com for help using APK splits with App Distribution.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 19s
1 actionable task: 1 executed
10:18:23 PM: Task execution finished 'appDistributionUploadRelease'.
仅供参考,我的应用已根据不同的 ABI 拆分输出 APK:
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86, armeabi-v7a, and mips.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "armeabi-v7a", "arm64-v8a"
// Specifies that we want to also generate a universal APK that includes all ABIs.
universalApk true
}
}
我想这就是为什么这个插件对上传哪个 APK 感到困惑的原因。
这是构建后创建的 apk 列表:
app-arm64-v8a-release.apk
app-armeabi-v7a-release.apk
app-universal-release.apk
更新:
我检查了插件源代码并注意到有一个名为 apkPath
的未记录的 属性 我应该设置它,但仍然没有成功。
在对 Firebase App 分发 jar 文件进行反编译和逆向工程并阅读代码后,我找到了这个解决方案:
applicationVariants.all { variant ->
variant.outputs.each { output ->
// Filter is null for universal APKs.
def filter = output.getFilter(OutputFile.ABI)
if (filter == null) {
tasks.findAll {
it.name.startsWith(
"appDistributionUpload${variant.name.capitalize()}")
}.each {
it.doFirst {
it.appDistributionProperties.apkPath = output.outputFile.absolutePath
}
}
}
}
}
注意:您必须依次执行assemble和应用分发上传Gradle任务:
./gradlew assembleRelease appDistributionUploadRelease
我通过设置 apkPath 解决了这个问题:
firebaseAppDistribution {
artifactPath="$rootDir/app/build/outputs/apk/...etc...[universal].apk"
serviceCredentialsFile="..."
testers="user@company.com"
}
我使用的版本是 2.1.2
我正在将基于 Google document 的 "Firebase App Distribution" 添加到我的 Android 应用程序,但是在 运行 appDistributionUploadRelease
Gradle 任务之后我收到此错误留言:
10:18:03 PM: Executing task 'appDistributionUploadRelease'...
Executing tasks: [appDistributionUploadRelease] in project C:\Users\mohsenoid\development\***\***-Android
> Task :app:appDistributionUploadRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:appDistributionUploadRelease'.
> App Distribution found more than 1 output file for this variant. Please contact firebase-support@google.com for help using APK splits with App Distribution.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 19s
1 actionable task: 1 executed
10:18:23 PM: Task execution finished 'appDistributionUploadRelease'.
仅供参考,我的应用已根据不同的 ABI 拆分输出 APK:
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86, armeabi-v7a, and mips.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "armeabi-v7a", "arm64-v8a"
// Specifies that we want to also generate a universal APK that includes all ABIs.
universalApk true
}
}
我想这就是为什么这个插件对上传哪个 APK 感到困惑的原因。
这是构建后创建的 apk 列表:
app-arm64-v8a-release.apk
app-armeabi-v7a-release.apk
app-universal-release.apk
更新:
我检查了插件源代码并注意到有一个名为 apkPath
的未记录的 属性 我应该设置它,但仍然没有成功。
在对 Firebase App 分发 jar 文件进行反编译和逆向工程并阅读代码后,我找到了这个解决方案:
applicationVariants.all { variant ->
variant.outputs.each { output ->
// Filter is null for universal APKs.
def filter = output.getFilter(OutputFile.ABI)
if (filter == null) {
tasks.findAll {
it.name.startsWith(
"appDistributionUpload${variant.name.capitalize()}")
}.each {
it.doFirst {
it.appDistributionProperties.apkPath = output.outputFile.absolutePath
}
}
}
}
}
注意:您必须依次执行assemble和应用分发上传Gradle任务:
./gradlew assembleRelease appDistributionUploadRelease
我通过设置 apkPath 解决了这个问题:
firebaseAppDistribution {
artifactPath="$rootDir/app/build/outputs/apk/...etc...[universal].apk"
serviceCredentialsFile="..."
testers="user@company.com"
}
我使用的版本是 2.1.2