23
/Volumes/SSD/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.10.0/7ef0f1d95bf4c0b3ba30bbae25e0e562b05cf75e/okhttp-3.10.0.jar: D8: Type `org.conscrypt.Conscrypt` was not found, it is required for default or static interface methods desugaring of `okhttp3.internal.platform.Platform okhttp3.internal.platform.ConscryptPlatform.buildIfSupported()`
Mark
  • 7,446
  • 5
  • 55
  • 75
smoothdvd
  • 2,389
  • 4
  • 20
  • 25
  • 1
    I'm running into the same error. Did you find a solution? – myanimal Jun 21 '18 at 20:48
  • 6
    I'm getting something similar: `AGPBI: {"kind":"warning","text":"Type \`libcore.io.Memory\` was not found, it is required for default or static interface methods desugaring of \`void com.google.android.gms.internal.measurement.zzyh$zzb.a(long, byte)\`","sources":[{"file":"/path/to/MyProject/app/build/intermediates/transforms/proguard/myvariant/release/0.jar"}],"tool":"D8"}` – Mark Sep 28 '18 at 08:07

4 Answers4

18

I was able to solve the problem with adding:

-dontwarn okhttp3.internal.platform.ConscryptPlatform

to the proguard-rules.pro file.

Ognyan
  • 13,452
  • 5
  • 64
  • 82
  • 15
    it seems that we are forcing the warning to go away, can you help me understand why exactly the warning is coming ? – pcsaunak Nov 27 '19 at 10:37
5

According to https://github.com/square/okhttp/issues/3922, it is safe to ignore these warnings.

If the build does not succeed, I suppose there is another problem.

mrek
  • 1,655
  • 1
  • 21
  • 34
4

Probably https://github.com/square/okhttp/issues/4604 will help, but I didn't try.

buildscript {
    ...
    repositories {
        ...
        maven {
            url 'http://storage.googleapis.com/r8-releases/raw'
        }
    }

    dependencies {
        classpath 'com.android.tools:r8:1.4.57'  // Must be before the Gradle Plugin for Android.
        classpath 'com.android.tools.build:gradle:3.3.1'  // You don't need to upgrade this to use a newer R8 version.
        ...
     }
}

In my case I added OkHttp library and it's Proguard rules. Then removed the library but forgot to remove rules. You can comment or remove these lines from proguard-rules.pro if you removed OkHttp from build.gradle:

### OkHttp.

# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**

# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*

# OkHttp platform used only on JVM and when Conscrypt dependency is available.
-dontwarn okhttp3.internal.platform.ConscryptPlatform
CoolMind
  • 26,736
  • 15
  • 188
  • 224
-1

From ./gradlew assemble

R8 is the new Android code shrinker. If you experience any issues, please file a bug at https://issuetracker.google.com, using 'Shrinker (R8)' as component name. You can disable R8 by updating gradle.properties with 'android.enableR8=false'. Current version is: 1.4.94 (build 390954928f0db9c3b888a367f7f128ce3bbfb160 from go/r8bot (luci-r8-ci-archive-0-5g74)).

brayskiy
  • 1
  • 1