Could not find method getCompileConfiguration() for arguments[] - android

I'm getting the following error.
Could not find method getCompileConfiguration() for arguments [] on
object of type
com.android.build.gradle.internal.api.ApplicationVariantImpl.

I was facing similar issue and after spent some time over internet I found below solution.
If you are using latest version of google-services in build.gradle then following changes need to be done :-
1) In project level build.gradle
buildscript {
repositories {
jcenter()
mavenLocal()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.3.1'
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
2) In App level build.gradle
android{
//All other
buildToolsVersion '27.0.3'
}
dependencies {
// All other
implementation 'com.google.firebase:firebase-database:15.0.1'
}
apply plugin: 'com.google.gms.google-services'
3) In gradle-wrapper.properties
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip

we had the same problem... solved by upgrading gradle in gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip
and the gradle plugin in gradle.build
repositories {
google()
...
}
dependencies {
...
classpath 'com.android.tools.build:gradle:3.1.0'
}

Related

Could not find com.android.tools.build:gradle:4.1.2

In Android Studio, I get this error when I create a project:
Could not find com.android.tools.build:gradle:4.1.2.
Correct your app top-level build.gradle file and include Maven repo to download plugin from:
buildscript {
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
mavenCentral()
}
}
Other option, it's possible to use beta version of Android Studio and upgrade to new version of AGP:
classpath 'com.android.tools.build:gradle:7.0.0-alpha07'

ERROR: Could not find com.android.tools.build:gradle:3.1.4.Required by: com.jakewharton:butterknife-gradle-plugin:10.1.0

While integrating WorkManager in my Application, I updated my app settings as follows:
androidMinSdkVersion = 15
androidTargetSdkVersion = 28
androidCompileSdkVersion = 28
androidBuildToolsVersion = "28.0.0"
Due to version upgrade to 28 I had to update gradle too.
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
Project.gradle
buildscript {
repositories {
// Gradle 4.1 and higher include support for Google's Maven repo using
// the google() method. And you need to include this repo to download
// Android Gradle plugin 3.0.0 or higher.
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "http://dl.bintray.com/populov/maven" }
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
mavenCentral()
jcenter()
gradlePluginPortal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Due to all these changes(mainly WorkManger), I had to (was forced to) upgrade the butterknife library version to 9.0.0 at least.
So I updated it as follows in my app.gradle file
apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.butterknife'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:10.1.0'
}
}
But whenever I try to clean-build I keep getting following error in logcat.
ERROR: Could not find com.android.tools.build:gradle:3.1.4.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.jar
Required by:
project :_btn_payment > com.jakewharton:butterknife-gradle-plugin:10.1.0
Any help is appreciated.
You should move your classpath 'com.jakewharton:butterknife-gradle-plugin:10.1.0' to Project.gradle
butterknife 10.x only supports AndroidX-enabled builds.
You will changed to version 9.0.0
From gradle gradle plugin 3.0 apt has deprecated,delete classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
library build.gradle
apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.butterknife'
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0'
}
}

Android CI build: Could not find aapt2-proto.jar

I have failing build on a Bitbucket CI server:
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find aapt2-proto.jar (com.android.tools.build:aapt2-proto:0.3.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/aapt2-proto/0.3.1/aapt2-proto-0.3.1.jar
I searched similar questions that suggested the Google Maven repository is missing, but I am not missing it. Top level build file:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
And my app level build file:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.26.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
mavenCentral()
}
Try moving the google() method to the top of its execution block.
Maybe it's the order of repositories it searches in that causes the issue.
So for example, change this:
repositories {
maven { url 'https://maven.fabric.io/public' }
google() // from here
mavenCentral()
}
To this:
repositories {
google() // to here
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
If that doesn't help, instead of calling the google() method, try changing it to this:
maven {
url 'https://maven.google.com/'
name 'Google'
}
UPDATE
If all of the above didn't help - make sure your gradle version is at least 3.0.0:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
And the gradle-wrapper version is at least 4.1:
Usually located here: project_name/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
Source
Upgrading the Gradle wrapper (in gradle-wrapper.properties) to gradle-4.10.2-all.zip fixed the problem to me.
Update Gradle Version
From the android gradle release page you can check compatible version for your gradle plugin.
Update gradle version in gradle-wrapper.properties located inside yourProject/gradle/wrapper
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.0-all.zip
Plugin version Required Gradle version
2.3.0+ 3.3+
3.0.0+ 4.1+
3.1.0+ 4.4+
Note that order matters. google() should be top of any plugin repo.
For Android Studio version > 3.0
buildscript {
repositories {
google() // move it to top
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1' // your Android Studio Version
}
}
allprojects {
repositories {
google() // move it to top
jcenter()
}
google() plugin is needed since Android Studio version 3.0 or higher.
For Android Studio version < 3.0
buildscript {
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0' // your Android Studio Version
}
}
allprojects {
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}

Android Studio 3.1 : Could not find org.jetbrains.trove4j:trove4j:20160824

Yesterday, I updated Android Studio to 3.1 and I'm getting this error :
Could not find org.jetbrains.trove4j:trove4j:20160824.
Searched in the following locations:
https://repo.maven.apache.org/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
https://repo.maven.apache.org/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar
https://dl.google.com/dl/android/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
https://dl.google.com/dl/android/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar
Required by:
project :library > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1 > com.android.tools.lint:lint:26.0.1 > com.android.tools.lint:lint-checks:26.0.1 > com.android.tools.lint:lint-api:26.0.1 > com.android.tools.external.com-intellij:intellij-core:26.0.1
This is my project's gradle file :
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// classpath 'com.google.gms:google-services:1.5.0-beta2'
classpath 'com.google.gms:google-services:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my gradle-wrapper-properties's distdistributionUrl:
distdistributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
Try to replace all occurences of mavenCentral() with jcenter() in your gradle builds
Because jCenter will close in May, you should replace it with Maven. Thanks to giorgos.nl now we can add Trove4j:20160824. Thanks to Xavier Rubio Jansana we can replace maven { url 'https://plugins.gradle.org/m2/' } with gradlePluginPortal().
In root build.gradle write:
buildscript {
repositories {
google()
gradlePluginPortal()
}
}
allprojects {
repositories {
google()
mavenCentral()
// org.jetbrains.trove4j:trove4j:20160824.
gradlePluginPortal()
}
}
To add libraries that have not still been moved to mavenCentral, use this method.
Root build.gradle:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Then you should search GitHub repositories of not resolved libraries. App's build.gradle example with two libraries:
dependencies {
// When a library has tags.
implementation 'com.github.RedMadRobot:input-mask-android:6.0.0'
// When a library doesn't have tags.
implementation 'com.github.savvisingh:DateRangePicker:master'
}
Now we can launch an application and build apk without errors.
I had the same mistake ... and for me the following worked:
Add jcenter() to repositories {} of allprojects
And add compile 'org.jetbrains.trove4j: trove4j: 20160824' in the build.gradle app module
I had this same error. I also had jcentre() at the appropriate place. But still it was not working.
One thing you can do which worked for me is clear the caches:
1. Close Android Studio.
2. Clear caches in here:
C:\Users"username"\.android\caches
C:\Users"username"\.gradle\caches
3. Open Android Studio.
Also make sure you have the version of the gradle which is newer than the minimum required.

Fabric and new gradle 2 released

Yesterday I updated Android Studio 1.5 to Android Studio 2 and since that update my project can't be run.
I have this error:
Error:Cannot change dependencies of configuration ':android:classpath'
after it has been resolved.
As I see it, I think that the error comes from my Build.gradle (project)
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'io.fabric.tools:gradle:1.+'
}
I changed it to:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.+'
classpath 'io.fabric.tools:gradle:2.+'
}
It still doesn't work. Do you have any suggestions?
I've also updated to 2.0 and uses fabric too.
here's the buildscript and it works well.
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'io.fabric.tools:gradle:1.+'
}
}
you can have a try :)

Categories

Resources