question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to find method during gradle sync

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sureshjoshicommented, Nov 28, 2017

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

1reaction
mannodermauscommented, Nov 28, 2017

Thanks for reporting!

I’m assuming that your project is running with Gradle 4.2 or lower? It seems like the return type of their TaskInputs#property method was changed in 4.3: While it used to return TaskInputs, it now returns TaskInputPropertyBuilder. 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found