OutputFile sync Failed:not vaild caused by Android Studio 3.0

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.