我在尝试将右护卫集成到我的android/gradle项目时遇到了一些困难。
当我apply plugin: 'dexguard'时,我得到以下错误
Error:Unable to load class 'com.android.builder.SdkParser'编辑:
这是我的应用程序的gradle文件:
buildscript {
repositories {
flatDir { dirs '/usr/local/DexGuard5.5.32/lib' }
jcenter()
}
dependencies {
classpath ':dexguard:'
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'dexguard' //This, when uncommented produces the error
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile files('libs/commons-collections4-4.0.jar')
compile files('libs/commons-codec-1.10.jar')
compile files('libs/gson-2.3.1.jar')
compile files('libs/jaxb2-maven-plugin:2.1.jar')
compile project(':sdk')
compile project(':zxing-lib')
}
android {
signingConfigs {
release {
//my signing config
}
}
compileSdkVersion 22
buildToolsVersion '23.0.1'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/main/java', 'src/main/native', 'src/test/java']
resources.srcDirs = ['src/main/java', 'src/main/native', 'src/test/java']
aidl.srcDirs = ['src/main/java', 'src/main/native', 'src/test/java']
renderscript.srcDirs = ['src/main/java', 'src/main/native', 'src/test/java']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
buildTypes {
//The following should be uncommented when dexuard works!!!
// debug {
// proguardFile plugin.getDefaultDexGuardFile('dexguard-debug.pro')
// proguardFile 'dexguard-project.txt'
// proguardFile 'dexguard-project-debug.txt'
// proguardFile 'proguard-project.txt'
// }
// release {
// proguardFile plugin.getDefaultDexGuardFile('dexguard-release.pro')
// proguardFile 'dexguard-project.txt'
// proguardFile 'dexguard-project-release.txt'
// proguardFile 'proguard-project.txt'
// }
}
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
}
}
defaultConfig {
targetSdkVersion 22
signingConfig signingConfigs.release
}
productFlavors {
app2 {
applicationId "some.app.id"
}
app {
applicationId "some.app.id2"
}
}
}你有什么想法?
发布于 2015-10-12 08:48:17
您的DexGuard插件看起来非常过时。据GuardSquare网站报道,最新版本是7.0.22。
升级是强制性的,因为7.x版带来了与gradle-plugin 1.3.x和build 23.x的兼容性。
发布于 2015-10-17 11:33:27
你的猫扔了什么?
Error:Unable to load class 'com.android.builder.SdkParser'致
这个问题是由android插件与gradle版本不匹配造成的。
实际上,您使用的是旧版本的 DexGuard5.5.32,这就是为什么有问题的原因。使用德克斯保卫 &最新的SDK和gradle插件的最新版本。
本节将介绍使用DexGuard强化应用程序的步骤,从确保通信是安全的,一直到加密字符串和类。
并升级您的tools.build:gradle版本以获得更好的方法。
dependencies {
classpath ':dexguard:'
classpath 'com.android.tools.build:gradle:1.4.0-beta2'
}问候
您可以设置compileSdkVersion 23 而不是22。
试着这样做,.I希望它能帮助你。
https://stackoverflow.com/questions/33017863
复制相似问题