Grade Plugin 3-alpha1 outputFile causes error

后端 未结 2 933
感动是毒
感动是毒 2021-02-20 16:54

I\'m trying to update a project to Android Studio 3.

The following snippet is no longer accepted in a build.gradle file.

applicationVariants.all { varian         


        
相关标签:
2条回答
  • 2021-02-20 17:40

    If your failing plugin support explicitly setting file path, it might be a work around.

    I had problems with Fabrics crashlyticsUploadDistributionRelease task, giving me the same stack trace as above. I fixed it by explicitly setting the output file path property in app/build.gradle:

    ext.betaDistributionApkFilePath = "app/build/outputs/apk/release/app-release.apk"

    0 讨论(0)
  • 2021-02-20 17:49

    Update: Fix for APK renaming:

    Use all iterators instead of each:

    android.applicationVariants.all { variant ->
        variant.outputs.all {
            outputFileName = "${variant.name}-${variant.versionName}.apk"
        }
    }
    

    Previous answer, still valid: It's a known problem with the new plugin:

    This build error occurs because variant-specific tasks are no longer created during the configuration stage. This results in the plugin not knowing all of its outputs up front, but it also means faster configuration times. As an alternative, we will introduce new APIs to provide similar functionality.

    We need to wait for an alternative way of doing that, according to the Migration Guide.

    0 讨论(0)
提交回复
热议问题