V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
inoridream
V2EX  ›  Android

引用 okhttp3 后编译报错,请教诸位怎样解决

  •  
  •   inoridream · 2019-04-11 14:05:39 +08:00 · 11345 次点击
    这是一个创建于 2057 天前的主题,其中的信息可能已经有所发展或是发生改变。
    implementation("com.squareup.okhttp3:okhttp:3.14.1")方式引用 okhttp3 后,执行编译,报错,内容如下:
    Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process D:\gradle\caches\modules-2\files-2.1\com.squareup.okhttp3\okhttp\3.14.1\67612a22d4b8f33c55263b188bf5a72774d06d18\okhttp-3.14.1.jar

    Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.

    Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete

    Caused by: com.android.tools.r8.utils.AbortException: Error: Static interface methods are only supported starting with Android N (--min-api 24): okhttp3.Request okhttp3.Authenticator.lambda$static$0(okhttp3.Route, okhttp3.Response)

    3 条回复    2019-04-11 14:33:40 +08:00
    unco020511
        1
    unco020511  
       2019-04-11 14:09:12 +08:00
    使用 jdk8
    inoridream
        2
    inoridream  
    OP
       2019-04-11 14:28:29 +08:00
    compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
    }
    qianji201712
        3
    qianji201712  
       2019-04-11 14:33:40 +08:00
    一楼正解
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3798 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 10:33 · PVG 18:33 · LAX 02:33 · JFK 05:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.