I updated my version of Android Studio to 3.4, it then asked me to upgrade Gradle to v5.1.1 from v4.10.1.
However the gradle project sync keeps failing now:
ERROR: Unable to find method
'org.gradle.api.tasks.SourceSetOutput.getClassesDir()Ljava/io/File;'.
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've tried all of those options but I'm still getting the same error. I found the below information about upgrading from v4 to v5:
The classesDir property has been removed from both the JDepend task
and SourceSetOutput. Use the JDepend.classesDirs and
SourceSetOutput.classesDirs properties instead.
https://docs.gradle.org/current/userguide/upgrading_version_4.html
The only useful information it provides it to use the properties mentioned instead. But I don't know what I need to be replacing, I can't see SourceSetOutput being used anywhere in my code. I don't suppose anyone else has come across this or knows how to fix this issue?
I have also tried upgrading to the latest Gradle version which is 5.4.1 but that doesn't seem to make a difference.
Just update Android Studio to 3.4 stable version. This is working for me :)
Related
I am unable to make the APK build. This started happening after I downgraded from Windows 10 to Windows 7 on only one project as of now. Other projects are working
fine. I tried to change Gradle class path version several times. I changed the Gradle wrapper versions as well.
Every time I get the following output:
Cause: invalid literal/lengths set.
I have also attached both build.gradle files with stacktrace file in the issue tracker:
Google Issue Tracker: My Issue
The log starts with: Failed to transform transport-runtime-2.2.1.aar and more. I was unable to find this error on Google.
MORE:
The following also produced sometimes:
Unable to load class 'butterknife.OnCheckedChanged'.
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 stopping the gradle build and re-downloading the dependencies using the links provided above, but nothing worked.
I also uninstalled and re-installed Android Studio. That didn't work as well.
I have removed butterknife library, but there are more sets of errors there in the build. Please see the link to Google Issue Tracker post above.
I had to update the following libraries to fix. One coroutine library was corrupted, so I had to delete and update the file in the .gradle/ root path location:
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0-alpha01'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0'
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.
This is a follow-up question here. I was initially trying to just install the .apk executable given by the Android project, but now I am trying to build the project myself, which is located at: https://github.com/garlicPasta/dotViewer
It is essentially supposed to receive a 3D graphics file (.ply format) from the server and visualize it.
The project is using Gradle, but when I'm trying to import it in Android Studio, I see the following message:
Error:Unable to find method 'com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V'.
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)</li><li>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)</li><li>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.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
I tried compiling it manually with gradle (installed gradle 2.10 to be compatible with the project). Can someone with more experience help me to import and run the project and find out what is missing for compiling?
BTW, there are two missing .java files which can be generated after compiling the .proto files.
I had the same Error after importing an Android-Project from Github.
I could fix it by copying the file PROJ_DIR/.idea/gradle.xml from an existing project.
I guess this is a problem gradle-2.14.1-all ,when I change the Gradle version to 3.3 ,then sync the project .This problem disappears。you can try it.
I am the error when trying to build an existing project in android studio 2.2.3
FIRST ERROR
Error:(1, 1) A problem occurred evaluating project ':app'.
Failed to apply plugin [id 'com.android.application']
Could not create plugin of type 'AppPlugin'.
The android gradle plugin version 2.3.0-beta1 is too old, please update to the latest version.
To override this check from the command line please set the ANDROID_DAILY_OVERRIDE environment variable to "38489eef475e39c9974f03c995d6529764875fa8"
Next step - Update latest build version
dependencies {
classpath 'com.android.tools.build:gradle:2.5.0-alpha-preview-01'
SECOND error
Error:Unable to find method 'org.gradle.api.artifacts.dsl.DependencyHandler.registerTransform(Ljava/lang/Class;Lorg/gradle/api/Action;)V'.
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.
If you are on Windows Environment, open System properties(right click My Computer), set(add if not there) environment variable ANDROID_DAILY_OVERRIDE, and set the value to 38489eef475e39c9974f03c995d6529764875fa8 or whatever coming on message log.
Restart your Android studio, project should build without any issues.
I was also facing this Daily Override issue after upgrading Repository it is gone now so also update your Android Studio.
Hope this helps!
Based on your original question, you are unlikely to want to use 2.5 at this point. We only released 2.5 alpha preview primarily for advanced early adopters to try at this point.
The reason you were getting the error is because preview versions of the Android Gradle plugin are time-bombed. You just need to update to a newer version. Simply change your line to:
classpath 'com.android.tools.build:gradle:2.3.0-rc1'
Once we publish the stable version, you can then change to:
classpath 'com.android.tools.build:gradle:2.3.0'
The stable version won't be time-bombed. Hope it helps.
If you haven't updated the Gradle version, you will need to update it to 3.3.
You might look at http://tools.android.com/tech-docs/new-build-system/2-5-alpha-gradle-plugin/trying-gradle-plugin-2-5 when you are using com.android.tools.build:gradle:2.5.0-alpha-preview-01
I've recently upgraded from 1.2.2 to 1.3.2 and was introduced with the following error:
Error:Unable to load class 'org.gradle.api.publication.maven.internal.DefaultMavenFactory'.
Possible causes for this unexpected error include:You are using JDK version 'java version "1.7.0_79"'. Some versions of JDK 1.7 (e.g. 1.7.0_10) may cause class loading errors in Gradle.
Please update to a newer version (e.g. 1.7.0_67).
Open JDK Settings
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.
My project is using the SquiDB library if that matters, has anyone encountered similar error and could help me out how to fix it?
I don't know why but following has worked:
Open the Settings panel
Go to Build, Execution, Deployment > Build Tools > Gradle
On right in the form under the Project-level settings heading select Use default gradle wrapper (Recommended)
In my case I had selected Use local gradle distribution for some reason.
if you know the reason behind the issue and solution applied please add another answer with explanation and I will make it accepted.
if your gradle.properties file which is located at the root level of your project contains :
classpath 'com.github.dcendents:android-maven-plugin:1.2',
try to change to:
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
I solved the same problem in this way, and hope you will as well.