0

In Android Studio, I am using CacheBuilder of Guava library:

com.google.common.cache.CacheBuilder

How to include just this utility?

Davoud
  • 2,576
  • 1
  • 32
  • 53

1 Answers1

2

Use ProGuard

Guava has an entire wiki section dedicated to your use case.

If you want to integrate ProGuard with Gradle, just use the following:

buildscript {
    repositories {
        flatDir dirs: '/usr/local/java/proguard/lib'
    }
    dependencies {
        classpath ':proguard:'
    }
}

You can find more info on ProGuard with Gradle here.

Olivier Grégoire
  • 33,839
  • 23
  • 96
  • 137
  • Your mean is that if I use Proguard, it will remove all of those unused libraries. Already I am using it. – Davoud Oct 30 '17 at 11:01
  • 3
    @Patzu It will remove **classes** from **`guava-xx.jar`** that are not needed by your application. So you keep only the classes from Guava you actually use directly or indirectly. – Olivier Grégoire Oct 30 '17 at 11:05