How to exclude external library jar from Proguard in Android Studio?

build.gradle

one of the modules in my project is pretty simple:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 8
    buildToolsVersion "21.1.2"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 8
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
        }
    }
}

dependencies {
    compile project(':timsvc')
    compile files('libs/jsoup-1.8.2.jar')
}

      

However, when I create it, it cannot find symbols in the external library jsoup-1.8.2.jar

.

Since timsvc

is my module having its own build.gradle and proguard.cfg, I can control its minify level and therefore I have no problem with it.

But I cannot do the same for jsoup-1.8.2.jar

it because it is an external banner.

Is there a way to exclude it from Proguard in Android Studio?

If so, how do you do it?

+3


source to share


1 answer


Your best bet is to see the library documentation and readme page (like Github).

but in genneral you can add the -keep options to your proguard config file for the classes in these external jars. For example:



-keep class example.** { *; }

      

0


source







All Articles