'android-24' requires JDK 1.8 or later to compile

后端 未结 8 2117
轮回少年
轮回少年 2021-02-01 00:12

I use Android Studio and recently got the error:

Error:Execution failed for task \':app:compileDebugJavaWithJavac\'. compileSdkVersion \'android-24\' re

8条回答
  •  死守一世寂寞
    2021-02-01 01:03

    I have a same problem for days. I found a solution which worked from me on Windows. (I also set environment variables, but don't know whether it's needed.)

    Add these lines to build.gradle file:

    android {
         ...
         defaultConfig {
              ...
              jackOptions {
                  enabled true
              }
         }
         compileOptions {
             targetCompatibility 1.8
             sourceCompatibility 1.8
         }
    }
    

    Source: https://code.google.com/p/android/issues/detail?id=203850

提交回复
热议问题