Skip to content

Unable to find method during gradle sync #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
youngam opened this issue Nov 28, 2017 · 5 comments
Closed

Unable to find method during gradle sync #34

youngam opened this issue Nov 28, 2017 · 5 comments
Labels

Comments

@youngam
Copy link

youngam commented Nov 28, 2017

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.
@mannodermaus
Copy link
Owner

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.

@mannodermaus
Copy link
Owner

mannodermaus commented Nov 28, 2017

@youngam
Copy link
Author

youngam commented Nov 28, 2017

@mannodermaus Thank you so much for your fast response! Really useful

@sureshjoshi
Copy link

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

@donMuthiani
Copy link

@mannodermaus Thank you. Really helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants