我正在尝试在带有 Gradle 的 Java 项目中使用 DexGuard 插件。它是 android 的库项目。
但我想直接链接 DexGuard 库:
apply plugin: 'com.android.application'
因为我需要使用:
apply plugin: 'java'
是否可以这样使用DexGuard插件?
我需要这种方式来使用,因为我需要使用额外的插件:
apply plugin: 'com.github.johnrengelman.shadow'
我在将此插件与 android 插件结合使用时遇到问题...
我的毕业典礼:
buildscript {
repositories {
jcenter()
flatDir dirs: 'DexGuard/lib'
}
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.2'
classpath ':dexguard'
}
}
apply plugin: 'java'
apply plugin: 'com.github.johnrengelman.shadow'
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: '**/*.jar')
}
sourceSets {
main {
java.srcDirs = ['src']
}
}
shadowJar {
...
}
task sdkDexguard(type: com.saikoa.dexguard.gradle.DexGuardTask) {
configuration 'dexguard.txt'
injars 'build/classes'
injars 'libs'
outjars 'build/application.apk'
}
我无法构建任务列表。行任务 sdkDexguard 出错:
Could not find property 'com' on root project
UPD 独立使用的 DexGuard 6.1.11 库中的问题。 GuardSquare 团队将很快解决这个问题。
最佳答案
问题已在 7.0.31 版本中解决。现在可以将此方法用于独立使用。
关于java - 如何在带有 Gradle 的 Java 项目中使用 DexGuard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34016146/