Default interface methods are only supported starting with Android N

Operating environment

Click the green hammer "make project" and the following error appears

Default interface methods are only supported starting with Android N (--min-api 24): 
    Landroidx/room/migration/AutoMigrationCallback;onPostMigrate(Landroidx/sqlite/db/SupportsqliteDatabase;)V

terms of settlement:

Add compileoptions to the Android part of the gradle of the module to specify the Java version

android {
    // ...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

Just hammer it again

Similarly, when a similar only supported starting with Android n occurs, you can also use the method of specifying the Java version above

Static interface methods are only supported starting with Android N (--min-api 24): 
    int androidx.constraintlayout.core.motion.utils.TypedValues$Attributes.getId(java.lang.String)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>