gpt4 book ai didi

android - Gradle项目刷新失败:方法PreDexCache.clear()的签名不适用

转载 作者:行者123 更新时间:2023-12-03 04:04:24 24 4
gpt4 key购买 nike

在导入项目的gradle同步期间出现一个奇怪的错误。我不知道该怎么解决。

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'
}
}

最佳答案

尝试调用./gradlew build。如果没有帮助,请给我您的构建脚本

编辑过

如果收到异常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

关于android - Gradle项目刷新失败:方法PreDexCache.clear()的签名不适用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30460309/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com