简体   繁体   English

Dexguard vs Android插件-中断构建过程

[英]Dexguard vs Android plugin - breaks build process

When i try to use dexguard plugin in place of android plugin ( dexguard plugin extends android ), my gradle build process fails with this error: 当我尝试使用dexguard插件代替android插件( dexguard插件扩展了android )时,我的gradle build process因以下错误而失败:

$ ./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'.

The first line build.gradle for my app module is 我的应用程序模块的第一行build.gradle是

apply plugin: 'dexguard'

The build.gradle for my whole project 我整个项目的build.gradle

// 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.+'
    }
}

I ran the gradlew with debug option enabled 我在启用debug选项的情况下运行了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

My gradle version is 2.1 我的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

If i use android instead of dexguard, then i have no issues. 如果我使用android而不是dexguard,那么我没有任何问题。

Any help or pointers are highly appreciated. 任何帮助或指针都将受到高度赞赏。 Thanks in advance. 提前致谢。

PS: I have no issues running ANT independently - fwiw. PS:我没有独立运行ANT问题-快。

The error suggests that you are using the DexGuard plugin with an incompatible version of the Android plugin. 该错误表明您正在将DexGuard插件与Android插件的不兼容版本一起使用。 For each version of DexGuard, you can find the compatible version documented in the DexGuard manual > Gradle build. 对于每个版本的DexGuard,您可以找到DexGuard手册> Gradle构建中记录的兼容版本。 For reference, you can also find working samples in the directory samples . 作为参考,您还可以在样本目录samples找到工作samples

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM