Gradle build process is failing - android

My project was successfully building and all of a sudden I got the below error in Android studio.
Unable to find method 'org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal.getPublishableFiles()Lorg/gradle/api/file/FileCollection;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
I tried clearing the local dependency cache and rebuilding the project. But still the error persists.
I am using android studio v4.0 with build tools v29.0.2.
Is it because gradle can't download the dependency from maven repo?
Is it because there is an error in configuring maven in my 'respositories' list?
How can I get more information on this error?

Try to update the com.jfrog.artifactory version.

My resolution for this was to update the artifactory version like #disha4mourya suggested - add this block to your project's build.gradle, directly after your buildscript block:
plugins {
id "com.jfrog.artifactory" version "4.18.3"
}

Related

Capacitor v3 Some Errors

When ı update my capacitor to 3v ı get some warnings and error. How can i fix it ?
Warning 1 :
Using flatDirs should be avoided because it doesn't support any meta-data formats.
Currently detected usages:
- repository flatDir used in: project ':app', project ':capacitor-cordova-android-plugins'
Warning 2 :
Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
This repository is deprecated and it will be shut down in the future.
See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
Currently detected usages in: root project 'android', project ':app', project ':capacitor-android', ...
Error :
Unable to find method 'org.gradle.api.artifacts.result.ComponentSelectionReason.getDescription()Ljava/lang/String;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
You just need to update android studio and it will work again !

Android Studio Error - Unable to load class 'com.google.gson.JsonParseException'

I am getting below error in Android Studio.
I tried these things but it didn't work for me.
Deleted the .gradle folder and resync the project
Manually downloaded the gradle distribution & in settings changed gradle to use from specified location.
Unable to load class 'com.google.gson.JsonParseException'. Possible
causes for this unexpected error include: Gradle's dependency cache
may be corrupt (this sometimes occurs after a network connection
timeout.) Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping
all Gradle daemons may solve this problem. Stop Gradle build processes
(requires restart)
Your project may be using a third-party plugin which is not compatible
with the other plugins in the project or the version of Gradle
requested by the project.
In the case of corrupt Gradle processes, you can also try closing the
IDE and then killing all Java processes.
Make sure your using suitable version of Gson in gradle file implementation 'com.google.code.gson:gson:<specific version>'
I highly recommend importing the library from your build.gradle instead of downloading it.
It might be a possibility that your Android Studio's gradle caches are corrupt. Fix for that is to got your .gradle folder in you Computer's home directory and navigate to caches folder and delete every thing inside it.

Gradle project sync failed after update - Unable to find method 'com.google.common.collect.ImmutableSet.toImmutableSet()Ljava/util/stream/Collector;'

I recently opened up an old project, updated Android Studio to 3.1.3, and am now unable to run the project. This is the message I receive:
Unable to find method 'com.google.common.collect.ImmutableSet.toImmutableSet()Ljava/util/stream/Collector;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
This message is followed up by this one on the second attempt:
Could not initialize class com.android.build.gradle.internal.ide.ModelBuilder
Gradle Project sync failed
The gradle project sync keeps failing, I've tried all of these solutions below, including invalidating/restarting cache, deleting .gradle file, etc.
Unsuccessful solutions
I'm not an Android wiz, so if anyone can lead me in the right direction it would be greatly appreciated!
I suspect that this has to do with conflicts in Guava depending on the
Gradle version you use and the Guava version your dependencies use.
The function toImmutableList was added in Guava 21 (Guava 20).
I suggest you try downgrading the project's gradle version to 3.3 or so and try again.

How to install the gradle-3.0 manually

I am trying to set up the new gradel-3.0 but I am getting error like this
Error:Cause:org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection
Possible causes for this unexpected error include:Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
I tried all the method given here ,I restarted my laptop also but then also I am getting the same error .How to fix this any hint will be helpful.
Upgrade your gradle build tools to:
classpath 'com.android.tools.build:gradle:2.2.0-beta1'

build unsuccessful in android studio

Hello I have a problem that I am experiencing when compiling my android application. It displays the error below. How can I solve the problem
Error:org.gradle.api.internal.changedetection.state.DefaultFileCollectionSnapshotter$FileCollectionSnapshotImpl
cannot be cast to org.gradle.api.internal.changedetection.state.OutputFilesCollectionSnapshotter$OutputFilesSnapshot
Possible causes for this unexpected error include:Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
Delete {project dir}/.gradle/{version}.
Sync Project with Gradle File

Categories

Resources