Faisal Shaikh
Faisal Shaikh

Reputation: 4147

Unable to find method 'org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)V'

When I try to build signed apk, I started getting the following issue:

Unable to find method 'org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)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.

Here is my gradle.properties:

#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

Here is android.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.google.firebase:firebase-plugins:1.1.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Upvotes: 3

Views: 14347

Answers (3)

Bruce
Bruce

Reputation: 1766

I use IntelliJ, and is I use gradle wrapper, I got:

Unable to find method 'org.gradle.api.tasks.SourceSet.getCompileConfigurationName()Ljava/lang/String;'.

I changed my gradle version in Gradle properties, but it not work, so I use local gradle distribution instead, and it worts.

enter image description here

Upvotes: 0

Hema Devi Vanapalli
Hema Devi Vanapalli

Reputation: 163

Change Gradle properties 

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip


Change distributional like below then it will works 
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

Upvotes: 5

Md. Asaduzzaman
Md. Asaduzzaman

Reputation: 15433

Update the classpath com.android.tools.build:gradle to latest version in your project gradle.

classpath 'com.android.tools.build:gradle:3.5.1'

Upvotes: 8

Related Questions