gpt4 book ai didi

android - 无法应用插件 : 'dexguard' at build. gradle 文件

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

当我将 apply plugin: 'dexguard' 添加到我的主模块的 build.gradle 文件中时出现以下错误。

Error:Unable to load class 'com.android.build.gradle.BasePlugin$PostCompilationData'. Possible causes for this unexpected error include:

  • You are using JDK version 'java version "1.7.0_67"'. Some versions of JDK 1.7 (e.g. 1.7.0_10) may cause class loading errors in Gradle. Please update to a newer version (e.g. 1.7.0_67). Open JDK Settings
  • 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.

我的项目的 build.gradle 文件:

buildscript {
repositories {
flatDir dirs: 'C:/Users/devrimtu/Documents/Programs/DexGuard/DexGuard6.1/lib'
jcenter()
}
dependencies {
classpath ':dexguard'
classpath 'com.android.tools.build:gradle:1.2.3'
}
}

我的主模块的 build.gradle 文件:

apply plugin: 'com.android.application'
apply plugin: 'dexguard'

android {
..
buildTypes {
debug {
proguardFile getDefaultDexGuardFile('dexguard-debug.pro')
proguardFile 'dexguard-project.txt'
proguardFile 'proguard-project.txt'
}
release {
proguardFile getDefaultDexGuardFile('dexguard-release.pro')
proguardFile 'dexguard-project.txt'
proguardFile 'proguard-project.txt'
}
}
}

注意:如果我删除 apply plugin: 'dexguard' 行,错误变为:

Error:(29, 0) Gradle DSL method not found: 'getDefaultDexGuardFile()' Possible causes:

  • The project 'AndroidWorkSpace' may be using a version of Gradle that does not contain the method. Gradle settings
  • The build file may be missing a Gradle plugin. Apply Gradle plugin

额外内容:

  • 我有 DexGuard v6.1build.gradle 文件中的 flatDir dirs 是正确的位置。
  • Android Studio v 1.3.0(内部版本 141.2117773)
  • Android Studio 安装目录下的 Gradle gradle-2.4
  • 最佳答案

    将DexGuard升级到7.0.18版本后问题解决。

    关于android - 无法应用插件 : 'dexguard' at build. gradle 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32094820/

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