在导入项目的gradle sync期间,我收到一个奇怪的错误。我不明白如何解决。
Gradle project refresh failed
Error:No signature of method: com.android.builder.internal.compiler.PreDexCache.clear() is applicable for argument types: (java.io.File, com.android.build.gradle.internal.LoggerWrapper) values: [E:\GardleWorkSpace\MAIN_APP\build\intermediates\dex-cache\cache.xml, ...]
Possible solutions: clear(java.io.File, com.android.utils.ILogger), load(java.io.File), grep(), collect(), every(), sleep(long, groovy.lang.Closure)
我尝试过多次删除和导入。 另外** E:\ GardleWorkSpace \ MAIN_APP \ build **我的机器中不存在此文件夹。
请帮忙。我已经尝试了很多搜索,但找不到同样问题的人。错误表明我不了解如何以及在何处应用某些解决方案。
的build.gradle
import org.apache.tools.ant.taskdefs.condition.Os
project.ext.set("archivesBaseName", "Project");
android {
dependencies {
// Support Library Features (https://developer.android.com/tools/support-library/features.html)
compile group:'com.android.support', name:'support-v4', version: '22.0.0'
compile group:'com.android.support', name:'palette-v7', version: '21.0.0'
}
defaultConfig {
versionCode 221505001
versionName "1.0"
minSdkVersion 22
targetSdkVersion 22
multiDexEnabled true
}
dexOptions {
jumboMode = true
if (Os.isFamily(Os.FAMILY_WINDOWS) && Os.isArch("x86")) {
javaMaxHeapSize "1g"
} else {
javaMaxHeapSize "2g"
}
}
lintOptions {
quiet true // set to true to turn off analysis progress reporting by lint
abortOnError false // if true, stop the gradle build if errors are found
ignoreWarnings true // if true, only report errors
checkAllWarnings true // if true, check all issues, including those that are off by default
warningsAsErrors true // if true, treat all warnings as errors
disable 'TypographyFractions', 'TypographyQuotes' // turn off checking the given issue id's
//enable 'RtlHardcoded','RtlCompat', 'RtlEnabled' // turn on the given issue id's
check 'NewApi', 'InlinedApi' // check *only* the given issue id's
noLines true // if true, don't include source code lines in the error output
showAll true // if true, show all locations for an error, do not truncate lists, etc.
textReport true // if true, generate a text report of issues (false by default)
textOutput 'stdout' // location to write the output; can be a file or 'stdout'
}
}
答案 0 :(得分:0)
尝试拨打./gradlew build
。如果它没有用,请告诉我你的构建脚本
<强> EDITED 强>
如果您获得例外Failed to apply plugin [id 'com.android.library']
,
那么你需要更新你的gradle版本。在你的root build.gradle中执行:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.+'
}
}
将版本字符串1.0.+
替换为最新版本,例如1.2.3
。
请记住,您的计算机上应该有最新的gradle