摇篮14.4构建失败 - 没有找到摇篮DSL法“的packageName() [英] Gradle 14.4 Fails to Build - Gradle DSL method not found 'packageName()'

查看:232
本文介绍了摇篮14.4构建失败 - 没有找到摇篮DSL法“的packageName()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用productFlavors并试图改变取决于风味的packageName:

  productFlavors {
    flavor1 {
        软件包名com.mypackagename.one
    }
    flavor2 {
        软件包名com.mypackagename.two
    }
}

这是工作的罚款,直到我更新到摇篮0.14.4,现在它失败,出现以下消息:

 错误:(21,0)摇篮DSL方法未找到:'的packageName()可能的原因:项目'MyProject的'可使用版本摇篮的不包含的方法。
< A HREF =open.wrapper.file>打开包装摇篮和文件LT; / A>构建文件可能丢失一个摇篮插件。
&所述; A HREF =apply.gradle.plugin>适用摇篮插件&下; / A>


  1. 我怎样才能解决这个问题,同时保留改变packageNames我口味的能力?


  2. 如果这仅仅是因为该方法名称已更改,我在哪里去了解这些变化?我似乎无法找到相关的更新日志,或更新的文档,解释如何做到这一点。



解决方案

  

我怎样才能解决这个问题,同时保留改变packageNames我口味的能力?


将其更改为的applicationID

  productFlavors {
    flavor1 {
        的applicationIDcom.mypackagename.one
    }
    flavor2 {
        的applicationIDcom.mypackagename.two
    }
}


  

我在哪里去了解这些变化?


目前,去上的工具网站的文档。

I'm using productFlavors and attempting to change the packageName depending on the flavor:

productFlavors {
    flavor1 {
        packageName "com.mypackagename.one"
    }
    flavor2 {
        packageName "com.mypackagename.two"
    }
}

This was working fine until I updated to Gradle 0.14.4, now it fails with the following message:

Error:(21, 0) Gradle DSL method not found: 'packageName()'

Possible causes:

The project 'MyProject' may be using a version of Gradle that does not contain the method.
<a href="open.wrapper.file">Open Gradle wrapper file</a>

The build file may be missing a Gradle plugin.
<a href="apply.gradle.plugin">Apply Gradle plugin</a>

  1. How can I resolve this issue, whilst retaining the ability to change the packageNames for my flavors?

  2. If this is simply because the method name has changed, where do I go to find out about these changes? I can't seem to find the associated changelog, or an updated doc explaining how to do this.

解决方案

How can I resolve this issue, whilst retaining the ability to change the packageNames for my flavors?

Change them to applicationId:

productFlavors {
    flavor1 {
        applicationId "com.mypackagename.one"
    }
    flavor2 {
        applicationId "com.mypackagename.two"
    }
}

where do I go to find out about these changes?

At the moment, go to the documentation on the tools site.

这篇关于摇篮14.4构建失败 - 没有找到摇篮DSL法“的packageName()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆