Could not find property 'outputFile' on com.android.build.gradle.internal.api.ApplicationVariantImpl

Android studio从1.0 RC 4升级到1.0(其实就是打了一个8M的patch)后,这个时候相应的gradle的版本也会直接使用“com.android.tools.build:gradle:1.0.0”,如果这时你在gradle文件中又用到outputFile就会出现上述的问题。好吧,其实这也是gradle团队搞的问题,有时候我们多希望gradle能像android一样,对旧版本有一个非常好的兼容性。

废话不多说,直接说怎么解决这个问题吧,这个问题的原因是outputFile这个函数被换地方了。

old:

applicationVariants.all { variant ->
            ......
            variant.outputFile = new File(variant.outputFile.parent, name);
	    ......
            }

}


new:

applicationVariants.all { variant ->
            ......
            variant.outputs.each { output ->
                output.outputFile = new File(output.outputFile.parent, name);
	    ......
            }

}


按上述方式改就ok了。

Could not find property 'outputFile' on com.android.build.gradle.internal.api.ApplicationVariantImpl

时间: 2024-08-15 06:15:45

Could not find property 'outputFile' on com.android.build.gradle.internal.api.ApplicationVariantImpl的相关文章

android开发里跳过的坑-AS导入NDK工程提示错误 No such property: sdkHandler for class: com.android.build.gradle.LibraryPlugin

接到一个NDK工程需要调试,导入后发现总是提示错误 Error:(37, 1) A problem occurred evaluating project ':libuvccamera'.> No such property: sdkHandler for class: com.android.build.gradle.LibraryPlugin 百度上各种说法,有说要降低gadle版本,有说要在环境变量里配置ANDROID_NDK的路径,试验了都不行,最后参考别人NDK gradle文件修改如

java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0解决办法

androidstudio编译程序时出现java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0.Unsupported major.minor version 52.这个错误是由于(jdk)高版本的java project使用了低版本的来运行.使用命令(java -version 和 javac -version)查看java

Android build.gradle 配置

一.初始配置:(新建项目自动配置好的): 1.build.gradle(app) apply plugin: 'com.android.application' //下边apk重命名使用 static def buildTime() { def date = new Date() def formattedDate = date.format('yyyyMMdd-HHmm') def iml = new File('app/app.iml') if (iml.exists()) { return

android build.gradle(groovy)

一.build.Gradle 这个 build.Gradle 文件来自 drakeet 大神的 Meizi 项目我直接在代码上加注释,参照着注释看代码就行,是不是发现有很多代码平时都没看见过. 1 //Model都有各自的build.gradle,这里声明该Model作为主项目,常见的还有另一个取值: 2 //apply plugin: 'com.android.library' 声明该Model作为库使用,当然还有其他取值,后面博客会介绍 3 apply plugin: 'com.androi

android 的build.gradle 的API手册

问题:对于用gradle的来配置java的开发者都能在GRADLE_HOME/docs/dsl找到如何对其build.gradle文件的具体属性. 但是对于开发android的开发者就不能对于官方的"gradle"开发不行的. 所以需要找找google是否有另外写一份对于android的dsl. 经某个机缘巧合知道google把某些代码放在 github: https://github.com/google 然后我就作死在文本框里敲入“android”(理应敲入dsl) 就出现了“ht

SDK Location not found Android Studio + Gradle

extends: http://stackoverflow.com/questions/19272127/sdk-location-not-found-android-studio-gradle I had very similar situation (had a project on another machine and cloned it to my laptop and saw the same issue) and I looked in it. Error message was

Could not find property 'outputFile

* What went wrong: A problem occurred configuring project ':app'. > Could not find property 'outputFile' on com.and[email protected]7d035e8. 今天在打开一个旧的项目时,提示竟然编译不过.提示内容如上. 原因是gradle及对应的gradle-android插件更新,导致一些API发生变化,比如variant.outputFile已经不使用了,而改用outpu

Android Studio, gradle and NDK integration

With the recent changes (release 0.7.3 around Dec 27), the new Android Build System starts to be really interesting also if you are using the NDK! Now this is really easy to integrate native libraries in your package and generate APKs for different a

Android通过Gradle发布多渠道版本遇到的Gradle版本问题解决

今天在通过Gradle发布多渠道版本的时候,遇到了Gradle版本过低导致不支持manifestPlaceholders字段的问题,想尽各种办法升级Gradle.Gradle的插件,最后终于成功了,在这里把方法分享给大家. 本人使用的是Intellij IDEA 13,Gradle版本是1.8,Gradle插件版本是0.6.+,需要将Gradle升级到2.1,插件版本升级到0.14+.遇到的错误是: Deprecated dynamic property: "manifestPlaceholde