11

The build.gradle of 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 build it, it fails to find symbols in the external library jsoup-1.8.2.jar.

Since timsvc is a module of mine, having its own build.gradle and proguard.cfg, I can control its minify level, and so I don't have any problems with it.

But I cannot do the same for jsoup-1.8.2.jar because it is an externally provided jar.

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

If so, how do I accomplish that?

ususer
  • 653
  • 1
  • 6
  • 14
  • 1
    Did you try `-keep class org.jsoup.** { *; }` where **org.jsoup** refers to package name – Fer Sep 17 '15 at 06:57
  • Possible duplicate of [How to make Proguard ignore external libraries?](http://stackoverflow.com/questions/7721397/how-to-make-proguard-ignore-external-libraries) – Shirish Herwade Jun 06 '16 at 09:03
  • Possible duplicate of http://stackoverflow.com/questions/6870773/android-proguard-with-external-jar/6870844#6870844 – Shirish Herwade Jun 06 '16 at 09:10

1 Answers1

4

The best is to see the libraries documentations and readme page (like Github).

but in genneral you can add -keep options to your proguard configuration file for the classes in those external jars. For instance:

-keep class example.** { *; }
Shayan Amani
  • 5,787
  • 1
  • 39
  • 40