zoukankan      html  css  js  c++  java
  • Default interface methods are only supported starting with Android N

    运行环境

    • Android Studio 4.1.1
    • compileSdkVersion 29
    • buildToolsVersion "29.0.2"

    点击绿色锤子「make project」出现以下错误

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

    解决办法:

    在模块的gradle里的android部分加上compileOptions指定Java版本

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

    再锤一次就ok了

    同理,出现类似的only supported starting with Android N时,也可以用上面指定Java版本的方法

    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)
    
    一个软件工程师的记录
  • 相关阅读:
    .htaccess是什么?.htaccess几个简单应用
    php提高效率
    php require和include区别
    excel的常用公式
    php时间日期处理
    json详解
    python列表-增强的赋值操作
    python列表-使用
    python列表-简单操作
    python列表-定义
  • 原文地址:https://www.cnblogs.com/rustfisher/p/15456816.html
Copyright © 2011-2022 走看看