Most of us use Android Studio to change the build installation package naming in the following ways:
Applicationvariants.all {variant-Variant.outputs.each {out--- def ofile =out.outputfile // OutputFile causes failure //... }}
However, after updating to as3.0, synchronization fails. Someone on the StackOverflow (Http://stackoverflow.com/questions/44044031/grade-plugin-3-alpha1-outputfile-causes-error) said:
This build error occurs because Variant-specific tasks is no longer created during the configuration stage.
This results in the plugin isn't knowing all of its outputs up front, but it also means faster configuration times.
As an alternative, we'll introduce new APIs to provide similar functionality.
Search official Website Introduction: HTTPS://DEVELOPER.ANDROID.COM/STUDIO/PREVIEW/FEATURES/NEW-ANDROID-PLUGIN-MIGRATION.HTML#VARIANT_API
Discover Solutions:
If you use each () to iterate through the variant objects,//you need to start using all (). That's because each () iterates//through only the objects, already exist during configuration time-//but those object Don ' t exist at configuration time and the new model.//however, all () adapts to the new model by picking up object as th EY are//added during Execution.android.applicationVariants.all {variant- Variant.outputs.all { OutputFileName = "${variant.name}-${variant.versionname}.apk" }}
OutputFile sync Failed:not vaild caused by Android Studio 3.0