Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle 14.4 Fails to Build - Gradle DSL method not found 'packageName()'

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.

like image 570
Tim Malseed Avatar asked Nov 25 '14 01:11

Tim Malseed


1 Answers

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.

like image 72
CommonsWare Avatar answered Oct 21 '22 00:10

CommonsWare