使用Firebase应用程序分发分发APK拆分

使用Firebase应用程序分发分发APK拆分,firebase,firebase-app-distribution,app-distribution,Firebase,Firebase App Distribution,App Distribution,“是否可以将Firebase应用程序发行版与APK split一起使用?它没有声明对Assembly任务的依赖关系,是否有任何解决方法?”gradle插件的问题在于 不声明对assemblytask的依赖关系(通常,不管apk拆分如何,按照gradle约定,您不应该仅仅“期望”apk在那里) 不会为每个apk拆分生成任务,但可以为flavors生成任务 尝试以下解决方法: // Generate firebase app distribution task variants for all

“是否可以将Firebase应用程序发行版与APK split一起使用?它没有声明对
Assembly
任务的依赖关系,是否有任何解决方法?”

gradle插件的问题在于

  • 不声明对
    assembly
    task的依赖关系(通常,不管apk拆分如何,按照gradle约定,您不应该仅仅“期望”apk在那里)

  • 不会为每个apk拆分生成任务,但可以为flavors生成任务

  • 尝试以下解决方法:

    // Generate firebase app distribution task variants for all abis
    applicationVariants.all { variant ->
    variant.outputs.all { output ->
    def abi = output.getFilter(com.android.build.OutputFile.ABI)
    
    if (abi == null) return
    def abiName = abi.replace("_", "").replace("-", "")
    task("appDistributionUpload${abiName.capitalize()}${variant.name.capitalize()}", type: com.google.firebase.appdistribution.gradle.UploadDistributionTask_Decorated) {
    appDistributionProperties = new com.google.firebase.appdistribution.gradle.AppDistributionProperties(
    new com.google.firebase.appdistribution.gradle.AppDistributionExtension(),
    project,
    variant
    )
    appDistributionProperties.apkPath = output.outputFile.absolutePath
    appDistributionProperties.serviceCredentialsFile = project.file("secrets/ci-firebase-account.json")
    appDistributionProperties.releaseNotes = abi
    appDistributionProperties.groups = "ra-testers"
     
    // Add dependsOn respective assemble task, so it actually
    // builds apk it wants to upload, not just expect it to be there
    dependsOn "assemble${variant.name.capitalize()}"
    }
    }
    }
    

    gradle插件的问题在于

  • 不声明对
    assembly
    task的依赖关系(通常,不管apk拆分如何,按照gradle约定,您不应该仅仅“期望”apk在那里)

  • 不会为每个apk拆分生成任务,但可以为flavors生成任务

  • 尝试以下解决方法:

    // Generate firebase app distribution task variants for all abis
    applicationVariants.all { variant ->
    variant.outputs.all { output ->
    def abi = output.getFilter(com.android.build.OutputFile.ABI)
    
    if (abi == null) return
    def abiName = abi.replace("_", "").replace("-", "")
    task("appDistributionUpload${abiName.capitalize()}${variant.name.capitalize()}", type: com.google.firebase.appdistribution.gradle.UploadDistributionTask_Decorated) {
    appDistributionProperties = new com.google.firebase.appdistribution.gradle.AppDistributionProperties(
    new com.google.firebase.appdistribution.gradle.AppDistributionExtension(),
    project,
    variant
    )
    appDistributionProperties.apkPath = output.outputFile.absolutePath
    appDistributionProperties.serviceCredentialsFile = project.file("secrets/ci-firebase-account.json")
    appDistributionProperties.releaseNotes = abi
    appDistributionProperties.groups = "ra-testers"
     
    // Add dependsOn respective assemble task, so it actually
    // builds apk it wants to upload, not just expect it to be there
    dependsOn "assemble${variant.name.capitalize()}"
    }
    }
    }
    

    谢谢你的回答!谢谢你的回答!