Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot call getBootClasspath() before setTargetInfo() is called

I am new in android studio, when i sync android application i got error.

C:\Users\Mansukh\Desktop\layout\MaterialDesignLibrary-master\MaterialDesign\build.gradle

Error:(97, 0) Cannot call getBootClasspath() before setTargetInfo() is called.

Please anyone tell me what is error mean and what are the solution for this error. i try to find out problem on internet but i unable to got particular solution.

Here is my gradle.build file.

apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

android {
    compileSdkVersion 19
    buildToolsVersion '20.0.0'

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']

            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']

            renderscript.srcDirs = ['src']

            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
        androidTest.setRoot('tests')
    }

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 21
        versionCode 6
        versionName '1.4'
    }
}

ext.siteUrl = 'https://github.com/navasmdc/MaterialDesignLibrary'
ext.issueUrl = 'https://github.com/navasmdc/MaterialDesignLibrary/issues'
ext.gitUrl = 'https://github.com/navasmdc/MaterialDesignLibrary.git'

bintray {
    user = hasProperty('BINTRAY_USER') ? BINTRAY_USER : "navasmdc"
    key = hasProperty('BINTRAY_KEY') ? BINTRAY_PASSWORD : ""

    configurations = ["archives"]
    pkg {
        repo = 'maven'
        name = 'MaterialDesignLibrary'
        desc = 'This is a library with components of Android L to you use in android 2.2'
        websiteUrl = siteUrl
        issueTrackerUrl = issueUrl
        vcsUrl = gitUrl
        licenses = ['Apache-2.0']
        labels = []
        publicDownloadNumbers = true
    }
}

dependencies {
    compile 'com.nineoldandroids:library:2.4.+'
    compile 'com.android.support:support-v4:21.+'
}

install {
    repositories.mavenInstaller {
        pom {
            project {
                packaging 'aar'
                name 'MaterialDesignLibrary'
                url siteUrl
                licenses {
                    license {
                        name 'The Apache Software License, Version 2.0'
                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                    }
                }
                developers {
                    developer {
                        id 'navasmdc'
                        name 'Iván Navas'
                        email '[email protected]'
                    }
                }
                scm {
                    connection gitUrl
                    developerConnection gitUrl
                    url siteUrl
                }
            }
        }
    }
}

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

artifacts {
    archives javadocJar
    archives sourcesJar
}

task findConventions << {
    println project.getConvention()
}
like image 904
Mansukh Ahir Avatar asked Feb 24 '15 05:02

Mansukh Ahir


2 Answers

This a bug in Gradle 1.1.0 plugin as described here: Issue 152811. Fix is already released

Solution is to change plugin version to 1.1.1 or higher (currently available version is 1.1.2). classpath 'com.android.tools.build:gradle:1.1.2'

Update

There is another similar bug Android Gradle Plugin 1.1.0 breaks Javadoc tasks which is fixed in 1.2.2 version.

like image 189
MyDogTom Avatar answered Nov 08 '22 08:11

MyDogTom


i find some solution try this if work

do change in gradle file

task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath += files(ext.androidJar)
}

Above code replace by this one

task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
} 
like image 6
Mansukh Ahir Avatar answered Nov 08 '22 06:11

Mansukh Ahir