Unable to find method during gradle sync
See original GitHub issueI added dependency like described at Readme file
. I use AS 3.0.
build.gradle file:
apply plugin: 'com.android.application'
apply plugin: "de.mannodermaus.android-junit5"
android {
compileSdkVersion 26
defaultConfig {
applicationId "colibri.dev.com.juni5sample"
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
testImplementation junit5()
// (Optional) For running tests inside Android Studio 3.x (see below for details)
testCompileOnly junit5EmbeddedRuntime()
}
top-level build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.0.21"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And catch exception:
Unable to find method 'org.gradle.api.internal.TaskInputsInternal.property(Ljava/lang/String;Ljava/lang/Object;)Lorg/gradle/api/tasks/TaskInputPropertyBuilder;'. 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.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Gradle sync failed: Unable to find method - java - Stack Overflow
Couple of things to to rule out, try clearing your build folder and stopping java in task manager, this normally fixes most gradle...
Read more >Unable to find method 'org.gradle.api.internal.file ... - GitHub
Describe the bug Gradle cannot sync with the com.amazonaws.appsync plugin Unable to find method 'org.gradle.api.internal.file.
Read more >Java – Gradle sync failed: Unable to find method - iTecNote
Best Solution · Open the file under your-app-project\your-app-name\gradle\wrapper\gradle-wrapper. · Rename the folder name from "... · Change the classpath of your ...
Read more >Fix "Error Could not find method implementation() for ...
In case you are using the “implementation” configuration in an older version of Gradle, the Gradle will not recognize it and throw this...
Read more >Help/Discuss - Gradle Forums
ERROR: Unable to find method 'org.gradle.api.tasks.TaskInputs.file(Ljava/lang/Object;)Lorg/gradle/api/tasks/TaskInputs;'.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, this fixed my problem too. For anyone looking, in gradle-wrapper.properties, I needed to have this:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-all.zip
Thanks for reporting!
I’m assuming that your project is running with Gradle
4.2
or lower? It seems like the return type of theirTaskInputs#property
method was changed in4.3
: While it used to returnTaskInputs
, it now returnsTaskInputPropertyBuilder
. Kotlin’s static nature probably fails to resolve the method in a backwards-compatible manner. I had the same issue recently with another method as well.If it is an easy upgrade for you, please consider using Gradle
4.3.1
to get around this issue. I’ll prepare something to add backwards compatibility to this API.