Dexguard VS Android插件 - 符生成过程 [英] Dexguard vs Android plugin - breaks build process

查看:968
本文介绍了Dexguard VS Android插件 - 符生成过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用 dexguard 插件代替机器人插件( dexguard 插件扩展机器人),我的 gradle这个生成过程失败,此错误:

When i try to use dexguard plugin in place of android plugin (dexguard plugin extends android), my gradle build process fails with this error:

$ ./gradlew assembleDebug

FAILURE: Build failed with an exception.

* Where:
Build file '/projectRoot/app/build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':projectRoot:app'.
 Could not create plugin of type 'g'.

我的应用程序模块的第一行的build.gradle是

The first line build.gradle for my app module is

apply plugin: 'dexguard'

我的整个项目中的build.gradle

The build.gradle for my whole project

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        flatDir { dirs 'path-to-dexguard/lib' }
        mavenCentral()
    }
    dependencies {
        classpath ':dexguard:'
        classpath 'com.android.tools.build:gradle:0.12.+'
    }
}

我跑了 gradlew 调试选项启用

$ ./gradlew --debug assembleDebug
[ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.NoClassDefFoundError: com/android/builder/DefaultBuildType
[ERROR] [org.gradle.BuildExceptionReporter]     at com.saikoa.dexguard.g.$getStaticMetaClass(DexGuard)
[ERROR] [org.gradle.BuildExceptionReporter]     at com.android.build.gradle.BasePlugin.<init>(BasePlugin.groovy:2173)
[ERROR] [org.gradle.BuildExceptionReporter]     at com.android.build.gradle.AppPlugin.<init>(AppPlugin.groovy:37)
[ERROR] [org.gradle.BuildExceptionReporter]     at com.saikoa.dexguard.g.<init>(DexGuard:90)
[ERROR] [org.gradle.BuildExceptionReporter]     at org.gradle.api.internal.DependencyInjectingInstantiator.newInstance(DependencyInjectingInstantiator.java:62)
[ERROR] [org.gradle.BuildExceptionReporter]     at org.gradle.api.internal.plugins.DefaultPluginRegistry.loadPlugin(DefaultPluginRegistry.java:65)
[ERROR] [org.gradle.BuildExceptionReporter]     ... 46 more
[ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.ClassNotFoundException: com.android.builder.DefaultBuildType
[ERROR] [org.gradle.BuildExceptionReporter]     ... 52 more

我的 gradle这个版本是2.1

$ gradle -v
------------------------------------------------------------
Gradle 2.1
------------------------------------------------------------
Build time:   2014-09-08 10:40:39 UTC
Build number: none
Revision:     e6cf70745ac11fa943e19294d19a2c527a669a53
Groovy:       2.3.6
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.7.0_07 (Oracle Corporation 23.3-b01)
OS:           Mac OS X 10.9.5 x86_64

如果我使用Android,而不是dexguard,那我也没问题。

If i use android instead of dexguard, then i have no issues.

任何帮助或指针是高度AP preciated。先谢谢了。

Any help or pointers are highly appreciated. Thanks in advance.

PS:我有没有运行任何问题 ANT 独立 - FWIW

PS: I have no issues running ANT independently - fwiw.

推荐答案

该错误表明,你正在使用的插件DexGuard与Android插件不兼容的版本。对于DexGuard的每一个版本,你可以找到在DexGuard手册中的兼容版本>摇篮建设。作为参考,还可以在目录中查找工作的样本样品

The error suggests that you are using the DexGuard plugin with an incompatible version of the Android plugin. For each version of DexGuard, you can find the compatible version documented in the DexGuard manual > Gradle build. For reference, you can also find working samples in the directory samples.

这篇关于Dexguard VS Android插件 - 符生成过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆