Error:Failed to complete Gradle execution. Cause: unknown - android

I am not able to build my project since I get this error image
I tried every solution I could find but I had no luck. I'm using AS 2.1.3. This are my depencies:
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
This morning I was able to work without problems, the only thing I did was some changes in an AsyncTask.

I solved it by deleting the .gradle folder in C:\Users\MyUsername.

The problem is not in the network You just have to add
buildscript {
repositories {
jcenter()
}
dependencies {
// the latest version of the android-apt plugin
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
for apply plugin: 'com.neenbedankt.android-apt' this library .Hope this will help source

Related

A problem was found with the configuration of task ':app:spotlessJava' (type 'SpotlessTask'). after gradle 7 update

I have updated to gradle 7.0.0 and there is such error :
**
A problem was found with the configuration of task ':app:spotlessJava'
(type 'SpotlessTask').
Type 'com.diffplug.gradle.spotless.SpotlessTask' property 'target' is missing an input or output annotation.
**
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath 'com.google.gms:google-services:4.3.8'
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.24.2"
// Crashlytics Gradle plugin.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
project.tasks['preBuild'].dependsOn 'generateContactsXml'
apply plugin: "com.diffplug.gradle.spotless"
spotless {
java {
target '**/*.java'
googleJavaFormat('1.6').aosp()
removeUnusedImports()
}
}
project.tasks['preBuild'].dependsOn 'spotlessApply'
Your Spotless plugin is too old to run on Gradle 7. You have to upgrade it. https://github.com/diffplug/spotless/issues/880

Could not get unknown property 'packageForR' for task '::processDebugResources' of type

Bugs: I want to update Realm database from version 4.2.0 to 4.3.3, but after gradle sync, it will fail
Goal
Update Realm from 4.2.0 to 4.3.3
Expected Results
Gradle sync will success
Actual Results
Gradle sync failed with stacktrace:
Error:Execution failed for task ':QuizApp:processDebugResources'.
Could not get unknown property 'packageForR' for task
':QuizApp:processDebugResources' of type
com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.
Top level gradle file
buildscript {
repositories {
jcenter { url 'http://jcenter.bintray.com/' }
maven { url 'https://maven.fabric.io/public' }
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
mavenCentral()
google()
}
dependencies {
// classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.2.0-alpha01'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "com.github.nullstress:DependencyAnalysisPlugin:1.0.3"
classpath 'com.google.gms:google-services:3.1.0'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
classpath "io.realm:realm-gradle-plugin:4.3.2"
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.2'
}
}
I Try cleaning gradle cache and stop the gradle daemon. Then retry the build. But the problem remains
If you are using ButterKnife, just remove ButterKnife gradle plugin, and use the annotationProcessor + implementation version instead. See step bellow:
Remove apply plugin: 'com.jakewharton.butterknife' in gradle
Just use/add dependencies below in gradle instead:
dependencies {
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
I had similar problem after gradle plugin update from:
classpath 'com.android.tools.build:gradle:3.0.1'
to
classpath 'com.android.tools.build:gradle:3.1.0'
In my case problem was caused by butterknife plugin, which are not compatible with gradle plugin newer than 3.0.1
Unfortunately I haven't solved this problem yet. I had to downgrade gradle plugin to 3.0.1.
And now I'm wating for newer version of butterknife plugin.
Update:
https://github.com/JakeWharton/butterknife/issues/1201
https://github.com/realm/realm-java/issues/5731

Android studio connection reset error?

I have updated android studio 2.2.2 recently. Now i got connection reset error when i check sdks and adding dependency to build.gradle. I have no idea about this. guide me to remove this error.
Try adding mavenCentral() inside the buildscript.repositories enclosure, like so. put error log for eject answer
buildscript {
repositories {
jcenter()
mavenCentral() // This repo should have the gradle plugin
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

Plugin with id 'com.google.gms.google-services' not found

I am using google services at the very first time in my app(ionic platform). I am following this doc. While building my app, I got the following error message. Please help out. Thank you.
A problem occurred evaluating script.
Plugin with id 'com.google.gms.google-services' not found.
Please add the plugin to your project by updating your top-level build.gradle and your app-level build.gradle files as follows:
Add the dependency to your project-level build.gradle:
classpath 'com.google.gms:google-services:3.0.0'
Add the plugin to your app-level build.gradle:
apply plugin: 'com.google.gms.google-services'
More information regarding this can be found in GCM - Set up a GCM Client App on Android.
And, in addition to that, the guide or workaround given in GitHub - GCMPushPlugin might also help.
Add classpath com.google.gms:google-services:3.0.0 dependencies at project level build.gradle
Refer the sample block from project level build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

Error:Could not find com.android.tools.build:gradle:2.1.0-alpha1

I update my android studio and restart it, it works properly but when i try to imoprt my previous project it shows error somthing like that:
here is the snapshot of error...
Error during import the project
and here is my gradle file...
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0-alpha1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Try with other distribution of gradle.
Open gradle-wrapper.propertieswhich It's inside gradle/wrapper folder and in distributionUrl set another one which work, for example:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
EDIT
Try with this classpath in global build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
I had the same problem upgrading my Android Studio to 2.2.0. I changed the classpath property of my build.gradle file but the difference with the answers above is that I didn't put the version of the Gradle but the Android Studio's one and it worked. Note that you also need to verify the Ggradle home path in file>>settings>>build,execution,deployment>>gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
I had this problem today, and when I updated the Android Plugin Version to the recent one, it worked. So, I think when you meet this problem, you can update the Gradle and Android Plugin Version to the newest. It always works. This is my configuration:

Categories

Resources