簡體   English   中英

Dexguard vs Android插件-中斷構建過程

[英]Dexguard vs Android plugin - breaks build process

當我嘗試使用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'.

我的應用程序模塊的第一行build.gradle是

apply plugin: 'dexguard'

我整個項目的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.+'
    }
}

我在啟用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

我的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,那么我沒有任何問題。

任何幫助或指針都將受到高度贊賞。 提前致謝。

PS:我沒有獨立運行ANT問題-快。

該錯誤表明您正在將DexGuard插件與Android插件的不兼容版本一起使用。 對於每個版本的DexGuard,您可以找到DexGuard手冊> Gradle構建中記錄的兼容版本。 作為參考,您還可以在樣本目錄samples找到工作samples

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM