Default interface methods are only supported starting with Android N

后端 未结 10 1494
天命终不由人
天命终不由人 2020-11-27 10:17

I upgraded to android studio 3.1 and I\'m getting the following error:

Default interface methods are only supported starting with Android N (--min-api 24): vo         


        
相关标签:
10条回答
  • 2020-11-27 10:55

    This also happened to me but using Dynamic Features. I already had Java 8 compatibility enabled in the app module but I had to add this compatibility lines to the Dynamic Feature module and then it worked.

    0 讨论(0)
  • 2020-11-27 10:56

    Update your build.gradle(Module:app) add compileOptions block and add JavaVersion.VERSION_1_8

    apply plugin: 'com.android.application'
    
    android {
        .................
        .........................
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    
    0 讨论(0)
  • 2020-11-27 10:59

    As CommonsWare mentioned, for reference add this inside the android {...} closure in the build.gradle for your app module to resolve issue:

    android {
    ...
      compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    ...
    }
    
    0 讨论(0)
  • 2020-11-27 11:03

    You should use Java 8 to solve this, based on the Android documentation you can do this by

    clicking File > Project Structure

    and change Source Compatibility and Target Compatibility.

    and you can also configure it directly in the app-level build.gradle file:

    android {
      ...
      // Configure only for each module that uses Java 8
      // language features (either in its source code or
      // through dependencies).
      compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
      }
    }
    
    0 讨论(0)
提交回复
热议问题