我们大多使用 android studio 改变生成安装包命名会用以下方式:

applicationVariants.all { variant ->

    variant.outputs.each { out ->

        def oFile =out.outputFile  // outputFile causes failure

        //...
}
}

  但是更新到as3.0以后,会同步失败。stackoverflow上有人(http://stackoverflow.com/questions/44044031/grade-plugin-3-alpha1-outputfile-causes-error)说:

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.

 

查询官网介绍:https://developer.android.com/studio/preview/features/new-android-plugin-migration.html#variant_api

API change in variant output

  

发现解决方案:

// 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 that already exist during configuration time—
// but those object don't exist at configuration time with the new model.
// However, all() adapts to the new model by picking up object as they are
// added during execution.
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "${variant.name}-${variant.versionName}.apk"
}
}

  

Android studio 3.0 引起的 outputFile sync failed:not vaild的更多相关文章

  1. 错误异常 (1)Android Studio错误提示:Gradle project sync failed. Basic functionality (eg. editing, debugging) will not work properly

    [已解决]Android Studio错误提示:Gradle project sync failed. Basic functionality (eg. editing, debugging) wil ...

  2. Android Studio错误提示:Gradle project sync failed. Basic functionality (eg. editing, debugging) will not work properly

    Android Studio中出现提示: Gradle project sync failed. Basic functionality (eg. editing, debugging) will n ...

  3. Android Studio 3.0正式版填坑之路

    原文:https://www.jianshu.com/p/9b25087a5d7d   Android Studio 3.0启动图 序言 总看别人的文章,今天尝试着自己来写一篇.在逛论坛时候,无意间发 ...

  4. Android Studio 2.0使用指南

    一.下载界面.[无激活码 无序列码 无毒请放心使用][需将JAVA程序升级到1.8] 网址:http://www.android-studio.org/index.php/download/andro ...

  5. Android Studio 1.0.2项目实战——从一个APP的开发过程认识Android Studio

    Android Studio 1.0.1刚刚发布不久,谷歌紧接着发布了Android Studio 1.0.2版本,和1.0.0一样,是一个Bug修复版本.在上一篇Android Studio 1.0 ...

  6. Android Studio 1.0.1 + Genymotion安卓模拟器打造高效安卓开发环境

    我们开发安卓大多是使用Eclipse和安卓SDK中自带的安卓模拟器.当然,Google早就推出了自己的安卓开发环境——Android studio,在不久前,Google发布了Android Stud ...

  7. [Android] 环境配置之正式版Android Studio 1.0

    昨天看见 Android Studio 1.0 正式版本发布了:心里挺高兴的. 算是忠实用户了吧,从去年开发者大会一开始出现 AS 后就开始使用了:也是从那时开始就基本没有用过 Eclipse 了:一 ...

  8. [Android] android studio 2.0即时运行功能探秘

    即时运行instant Run是android studio 2中,开发人员最关心的特性之一 在google发布studio 2.0之后,马上更新体验了一把,然而发现,并没快多少,说好的即时运行呢? ...

  9. Windows环境下Android Studio v1.0安装教程

    Windows环境下Android Studio v1.0安装教程 准备工具 JDK安装包. 要求:JDK 7以及以上版本. Android Studio安装文件. Windows: exe(包含SD ...

随机推荐

  1. 【原创】Octovis在Ubuntu16.04下运行出现core dump的解决方案

    本人SLAM研究新手,使用系统为Ubuntu16.04.本文原址:http://www.cnblogs.com/hitlrk/p/6667253.html 在学习SLAM的过程中,使用Octomap进 ...

  2. vuejs学习笔记(1)--属性,事件绑定,ajax

    属性 v-for 类似于angular中的 ng-repeat ,用于重复生成html片段: <ul id="box"> <li v-for="(v, ...

  3. jQ层级选择器

    <!DOCTYPE html><html> <head> <meta charset="utf-8" /> <title> ...

  4. 新人小达之wpf

    Wpf学习之路-- 第一次写微博,可能内容不够精细,但目的就是把问题讲明白,让看到文章的小伙伴们少走弯路. 由于公司的需要,需要学习.net的一门新技术-wpf. 要说wpf是什么框架?模式?架构?  ...

  5. WPF自定义控件(2)——图表设计[1]

    0.小叙闲言 除了仪表盘控件比较常用外,还有图表也经常使用,同样网上也有非常强大的图表控件,有收费的(DEVexpress),也有免费的.但我们平时在使用时,只想简单地绘一个图,控件库里面的许多功能我 ...

  6. 给我的cnblogs主页做一个响应式布局模板

    在cnblogs,一直都是使用官方自带的那些模板,而且感觉也一直很良好!不过最近用手机搜索一些相关的技术资料,很多都来自cnblogs,有些博主的页面在和机端显得很好,有些则展示得不那么友好了……忽然 ...

  7. php判断多维数组的技巧

    直接上代码吧: if(count($array) == count($array, 1)){ echo '一维数组'; }else{ echo '多维数组'; } 看了下手册 int count (m ...

  8. 使用nodejs进行WEB开发

    这里,准备从零开始用nodejs实现一个微博系统.功能包括路由控制.页面模板.数据库访问.用户注册.登录.用户会话等内容. 将会介绍Express框架.MVC设计模式.ejs模板引擎以及MongoDB ...

  9. 前端魔法堂:解秘FOUC

    前言  对于问题多多的IE678,FOUC(flash of unstyled content)--浏览器样式闪烁是一个不可忽视的话题,但对于ever green的浏览器就不用理会了吗?下面尝试较全面 ...

  10. focus、blur事件的事件委托处理(兼容各个流浏览器)

    今天工作中遇到个问题,问题是这样的,一个form表单中有比较多的input标签,因为form中的input标签中的值都需要前端做客户端校验,由于本人比较懒而且特不喜欢用循环给 每个input元素添加b ...