Getting the below error when trying to build flavour types of my lib modules.
Error:(210, 0) Gradle DSL method not found: 'flavourOneReleaseCompile()'
Possible causes:<ul><li>The project 'MyProject' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Fix plugin version and sync project</li><li>The project 'MyProject' may be using a version of Gradle that does not contain the method.
Gradle settings</li><li>The build file may be missing a Gradle plugin.
Apply Gradle plugin</li>
build file
android{......}
configurations{
flavorOneDebugCompile{}
flavorOneReleaseCompileCompile{}
flavorTwoDebugCompile{}
flavorTworeleaseCompile{}
}
dependencies {
flavorOneDebugCompile project(path: ':lib', configuration: 'flavorOneDebug')
flavorOneReleaseCompile project(path: ':lib', configuration: 'flavorOneRelease')
flavorTwoDebugCompile project(path: ':lib', configuration: 'flavorTwoDebug')
flavorTwoReleaseCompile project(path: ':lib', configuration: 'flavorTwoRelease')
}
Im using
classpath 'com.android.tools.build:gradle:1.3.1'
i was following this guide on how to target specific build flavours
https://developer.android.com/studio/build/gradle-tips.html#target-specific-builds-with-dependency-configurations
You are using spelling mistake flavorOneReleaseCompileCompile in
configurations{
flavorOneDebugCompile{}
flavorOneReleaseCompileCompile{}
flavorTwoDebugCompile{}
flavorTworeleaseCompile{}
}
Try replacing flavorOneReleaseCompileCompile with flavorOneReleaseCompile
Related
Can we remove duplicate classes from the local .aar files in libs folder.
Duplicate class com.regina.first.core.C$RefreshWebClientQueryIds found in modules jetified-regina-runtime.jar (abc.aar) and jetified-gms-sdk-debug-runtime.jar (xyz.aar)
I have tried using-
implementation (files('libs/abc.aar')) {
exclude 'com.regina.first.core.C'
}
implementation fileTree(dir: 'libs', include: ['xyz.aar'])
But got the following response from the gradle although i am already using gradle version 4.0.1 -
Gradle DSL method not found: 'exclude()'
Possible causes:
The project 'atv-retail-app' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 4.0.1 and sync project
The project 'atv-retail-app' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file
The build file may be missing a Gradle plugin.
Apply Gradle plugin
Based on the official Gradle documentation in order to exclude a package/group from the dependency you should use the syntax below
dependencies {
implementation('commons-beanutils:commons-beanutils:1.9.4') {
exclude group: 'commons-collections', module: 'commons-collections'
}
}
I've an Android app in Android Studio. I'm using Gradle Version = 4.6, Android Tools Plugin Version=3.2.1. It has a app module (main) and a library module. And I hope all buildTypes depend on the same configuration.
my build.gradle(app):
dependencies {
api project(path: ':lib', configuration: 'custom')
}
But it is ERROR:
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve project :lib.
Try to replace your code like below
implementation project('path: ':lib', configuration: 'custom'')
i want to start using gcm in my project, and i follow google instruction for that, but when i add dependencies in my build.gradle file as follow :
top level :
classpath 'com.google.gms:google-services:3.0.0'
project level :
apply plugin: 'com.google.gms.google-services'
i have an error that says you must add firebase to your dependencies :
freeCompile 'com.google.firebase:firebase-core:9.0.0'
but after i add this to my dependencies i have another error like this :
Error:(74, 0) Gradle DSL method not found: 'freeCompile()'
Possible causes:The project 'testGCM' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
freeCompile specifies the gradle dependency block that only compile firebase-core for the product flavor free , so you if have not defined a free product flavor then ofcourse its not going to work.
In this case you can either add a new product flavor called free like so
android {
...
productFlavors {
free {
versionCode 1
versionName "1.0.0"
}
}
...
}
OR just replace freeCompile with compile , this will compile the firebase-core lib and make it available for all product flavors
I know that if I make a library that uses product flavors, then when I use that library in an application, I can do this in a gradle:
dependencies {
flavor1Compile(path: '{path}', configuration: 'flavor1Config')
flavor2Compile(path: '{path}', configuration: 'flavor2Config')
}
I also know that I can do this:
dependencies {
debugCompile(path: '{path}', configuration: 'debugConfig')
releaseCompile(path: '{path}', configuration: 'releaseConfig')
}
What I want to do is essentially this:
dependencies {
flavor1DebugCompile(path: '{path}', configuration: 'flavor1DebugConfig')
flavor1ReleaseCompile(path: '{path}', configuration: 'flavor1ReleaseConfig')
flavor2DebugCompile(path: '{path}', configuration: 'flavor2DebugConfig')
flavor2ReleaseCompile(path: '{path}', configuration: 'flavor2ReleaseConfig')
}
But that code produces this:
Error:(30, 0) Gradle DSL method not found: 'flavor1DebugCompile()'
Possible causes:The project 'android' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
Is there a way to do this?
There is an open bug on the Android issue tracker to support this.
As of right now, you can accomplish this by declaring a configuration like so for each combination you want to use:
configurations {
flavor1DebugCompile
}
dependencies {
flavor1DebugCompile(path: '{path}', configuration: 'flavor1DebugConfig')
}
I'm trying to setup nhaarman/ListViewAnimations inside of Android Studio 1.1.0.
From Setup:
Add the following to your build.gradle:
repositories {
mavenCentral()
}
dependencies {
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0#aar'
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0#aar'
compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0#aar'
}
yet Android Studio says:
Gradle project sync failed. Basic functionality (e.g. editing,
debugging) will not work properly.
Error:(26, 0) Gradle DSL method not found: 'compile()'
Possible causes:<ul><li>The project 'X' may be using a version of Gradle that does not contain the method.
Gradle settings</li><li>The build file may be missing a Gradle plugin.
Apply Gradle plugin</li>
You are adding these dependencies in the top level build.gradle file.
You have to add these lines in the module build.gradle file.
root
build.gradle //top level
app
build.gradle //module level
After adding those lines to:
build.gradle (Module: app)
instead of
build.gradle (Project: app)
the error is gone.
Try this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0'
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0'
}
Try removing #arr. worked for me.
//ListView Animations
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0'
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0'