How to resolve D8 warning: D8: Type `org.conscrypt.Conscrypt` was not found

前端 未结 4 1230
渐次进展
渐次进展 2021-02-12 12:27
/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.Co         


        
4条回答
  •  孤街浪徒
    2021-02-12 13:08

    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
    

提交回复
热议问题