This morning I upgraded Android Studio to use Gradle 6.1.1.
Now, my attempts to build fail with the following error:
Unable to find method
'org.gradle.api.tasks.TaskInputs.property(Ljava/lang/String;Ljava/lang/Object;)Lorg/gradle/api/tasks/TaskInputs;'.
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 used Gradle Build Scan to find the issue.
The issue is with the Greendao3GradlePlugin third party plugin.
Does anyone know how to resolve this?
You should update Greendao to the lastest version
// In your root build.gradle file:
buildscript {
repositories {
jcenter()
mavenCentral() // add repository
}
dependencies {
classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0' // add plugin
}
}
// In your app projects build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'org.greenrobot.greendao' // apply plugin
dependencies {
implementation 'org.greenrobot:greendao:3.3.0' // add library
}
Check Greendao release notes here
Related
I am getting the following error,
Unable to find method ''org.gradle.api.tasks.SourceTask org.jetbrains.kotlin.gradle.tasks.KotlinCompile.source(java.lang.Object[])''
'org.gradle.api.tasks.SourceTask org.jetbrains.kotlin.gradle.tasks.KotlinCompile.source(java.lang.Object[])'
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.
when upgrading kotlin-gradle-plugin from 1.6.21 to 1.7.10 in project level build.gradle file in an android project.
AS version is - 2021.2.1 patch 1
com.android.tools.build:gradle:7.2.1
Current kotlin plugin version installed in AS - 212-1.7.10-release-333-AS5457.46
None of the suggestions working :((
I got the same issue, in my case upgrading the apollo dependency to the last version solved the issue.
object Apollo {
const val APOLLO_RUNTIME = "com.apollographql.apollo:apollo-runtime:2.5.13"
const val APOLLO_RX = "com.apollographql.apollo:apollo-rx2-support:2.5.13"
}
api(Libs.Apollo.APOLLO_RUNTIME)
implementation(Libs.Apollo.APOLLO_RX)
Upgrade your dependencies to the last version and sync again.
Check at build.gradle(Project)
buildscript {
ext {
compose_version = '1.3.0-rc02'
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false // <--- Change this one to 1.7.10
}
task clean(type: Delete) {
delete rootProject.buildDir
}
After upgrading Android Studio to Fox version, Gradle from 4.1.3 to 7.0.0 or even 4.2.+, and distributionUrl to gradle-7.0.1-bin.zip, I couldn’t build my app anymore.
This is the error log:
* What went wrong:
Execution failed for task ':onboarding:dataBindingMergeDependencyArtifactsDebugMobDebug'.
> Could not resolve all files for configuration ':onboarding:debugMobDebugCompileClasspath'.
> Could not resolve android.arch.navigation:navigation-ui-ktx:2.3.5.
Required by:
project :onboarding
> Skipped due to earlier error
It seems Gradle couldn't download NavigationKTX version 2.3.5.
The solution is downgrading but
How to fix the issue without downgrading to Gradle version 4.1.+
I wanna use jetpack compose in my application so I need to update gradle to 4.2.+.
The current Gradle version for Arctic Fox is eg. gradle-7.1.1-all.zip (or bin).
AGP & SafeArgs:
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
// classpath "com.android.tools.build:gradle:4.2.2"
// classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5"
classpath "com.android.tools.build:gradle:7.0.0"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.4.0-alpha02"
}
}
...
apply plugin: "androidx.navigation.safeargs.kotlin"
And the whole android.arch name-space had been superseded:
android.arch.navigation:navigation-ui-ktx:2.3.5
Use the current androidx name-space instead, where 2.3.5 is the latest stable version:
androidx.navigation:navigation-ui-ktx:2.3.5 / 2.4.0-alpha06
Be aware not to mix up these library name-spaces (there may be further conflicts) - or that enabling the Jetifier may be required, depending on further outdated dependencies (because name-space com.android.support had also been superseded by androidx). Unless a) updating the dependencies and b) fixing all imports ...this project won't build.
org.codehaus.groovy.ast.expr.TupleExpression cannot be cast to org.codehaus.groovy.ast.expr.ArgumentListExpression
org.codehaus.groovy.ast.expr.TupleExpression cannot be cast to org.codehaus.groovy.ast.expr.ArgumentListExpression
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.
enter code here
After restarting or rebuild the Error steel appears.
Put app / module in build In the gradle file, if your plugins are like this:
plugins { id plugin: 'com.android.application'}
Change to: apply plugin: 'com.android.application'。
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"
}
I have read through all of the existing stack questions relating to this and their solutions did not help me.
This problem has been evident since all AS updates above 2.3.
Creating a new project is ok and builds
I've attempted to copy all values from the 'new project' but it still persists
The error:
Error:Unable to load class 'org.gradle.api.internal.component.Usage'.
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.
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
Project build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha5'
classpath "io.realm:realm-gradle-plugin:0.89.1"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Settings Gradle
Use default gradle wrapper
Module Settings
Compile Sdk Version: API 26
Build Tools Version: 26.0.0
I believe these are all the latest available.
And I have tried invalidate caches & restart / rebooting the machine
I tried all the above suggestions for deleting cache and nothing worked for me. In the end, the problem was the plugin com.novoda:bintray-release:0.4.0. When I upgraded it to 0.5.0, it worked.
I would take a hard look at your gradle plugins!
Delete Gradle cache C:/users/<yourname>/.gradle (delete the whole directory actually). Then upgrade Gradle and try again.
Or if you are using Gradle wrapper go into properties and upgrade the version of the wrapper ./gradle/wrapper/gradle-wrapper.properties
Your question doesn't specify the versions, then I assume this might be your problem.
Edit: Check if your plugins are still Compatible with your version of Gradle
io.realm:realm-gradle-plugin:0.89.1 seems a bit old there is a version 3.5.0 already
Since Gradle 3.4 Usage was renamed to UsageContext and maybe one of your plugins, or dependencies is not compatible with Gradle 4.1-milestone that you are using by looking at the distribution Url.