我是android studio中的新手,当我同步android应用程序时,我收到了错误。
C:\Users\Mansukh\Desktop\layout\MaterialDesignLibrary-master\MaterialDesign\build.gradle
Error:(97, 0) Cannot call getBootClasspath() before setTargetInfo() is called.
请有人告诉我什么是错误意味着什么是这个错误的解决方案。我试图在网上找出问题,但我无法得到特别的解决方案。
这是我的 gradle.build 文件。
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 'i.navas.mdc@gmail.com'
}
}
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()
}
答案 0 :(得分:54)
这是Gradle 1.1.0插件中的一个错误,如下所述:Issue 152811。修复已经released
解决方案是将插件版本更改为1.1.1或更高版本(当前可用版本为1.1.2)。
classpath 'com.android.tools.build:gradle:1.1.2'
<强>更新强>
还有另一个类似的错误Android Gradle Plugin 1.1.0 breaks Javadoc tasks,已在1.2.2版本中修复。
答案 1 :(得分:6)
我找到了一些解决方案,试试这个
在gradle文件中进行更改
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath += files(ext.androidJar)
}
以上代码替换为此
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}