2015-08-19 1 views
2

Ниже приведена ошибка, когда я добавляю apply plugin: 'dexguard' в мой основной модуль build.gradle файл.Невозможно применить плагин: '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.1. И flatDir dirs на build.gradle файл является правильным местом.
  • Android Студия v 1.3.0 (build 141.2117773)
  • Gradle под Android установка Студия реж gradle-2.4
  • ответ

    0

    Проблема решена после обновления DexGuard до версии 7.0.18.