简体   繁体   中英

Integrating DexGuard into Android Studio

Has anyone of you managed to install DexGuard as a plugin to Android Studio? I am trying to do so with DexGuard 6.1 and Android Studio 1.1.0 using Settings>Plugin>Install from disk , however both libs/dexguard.jar and eclipse/com.saikoa.(...).jar files result in

" Failed to load plugin descriptor for file ((the_selected_jar)) "

error.

I also attempted to do it manually (copying jars to Android Studio/plugins folder and editing gradle files), but no luck with that neither.

I could go with ProGuard, but I would like to use DexGuard for the encryptstrings function.

I recall the for Eclipse there was a plugin, but I thought DexGuard integrates with Gradle, rather than Android Studio IDE. So there should not need to install a .jar plugin per say.

This sample from the DexGuard docs

buildscript {
    repositories {
        mavenCentral()
        flatDir { dirs '/YOUR_LOCAL_PATH_HERE/DexGuard6.1/lib' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
        classpath ':dexguard:'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'dexguard'

android {
    .....
    buildTypes {
        debug {
            proguardFile getDefaultDexGuardFile('dexguard-debug.pro')
            proguardFile 'dexguard-project.txt'
            proguardFile 'proguard-project.txt'
        }
        release {
            proguardFile getDefaultDexGuardFile('dexguard-release.pro')
            proguardFile 'dexguard-project.txt'
            proguardFile 'proguard-project.txt'
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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