Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process guava-21.0.jar Android 3.1 Dev Channel

Solution 1:

I had the same issue in react-native project,

the below lines worked for me,

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
} 

Solution 2:

Update your Guava version

Guava 21 is Java 8 only.

Update your gradle to Guava version 27.0.1-android, which is compatible with Android:

Gradle 4.6+:

dependencies {
  implementation 'com.google.guava:guava:27.0.1-android'
}

Previous Gradle versions:

dependencies {
  compile 'com.google.guava:guava:27.0.1-android'
}

Solution 3:

I had same problem and I solved it cleaning project and rebuilding it.

In Android Studio go to Build --> Clean Project and after, Build --> Rebuild Project

Hope it helps

Solution 4:

I had the similar case when I switched to OkHttp 4.x. It turned out that I had to disable the method profiling in run configuration: Edit Configurations -> app -> Profiling tab -> uncheck Enable advanced profiling. It solved my case but I cannot use profiling now on older devices.