Default interface methods are only supported starting with Android N

栏目: IOS · Android · 发布时间: 7年前

内容简介:依赖旧版本:更新为以下版本:构建时出现错误:

依赖旧版本:

implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
implementation 'androidx.core:core-ktx:1.1.0-alpha05'

更新为以下版本:

implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
implementation 'androidx.core:core-ktx:1.2.0-alpha02'

构建时出现错误:

Error: Default interface methods are only supported starting with Android N (--min-api 24): android.view.MenuItem androidx.core.internal.view.SupportMenuItem.setContentDescription(java.lang.CharSequence)

按照以下步骤,先点击 Android Studio 右上角 Project Structure 图标(右二)

Default interface methods are only supported starting with Android N

在该设置中选择 app 模块,把 Source CompatibilityTarget Compatibility 均设置为 1.8

Default interface methods are only supported starting with Android N

当然,也可以手动在 build.gradle(Module:app) 中添加代码:

compileOptions {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
}

这是添加完成后的效果,继续编译即可

Default interface methods are only supported starting with Android N


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Squid: The Definitive Guide

Squid: The Definitive Guide

Duane Wessels / O'Reilly Media / 2004 / $44.95 US, $65.95 CA, £31.95 UK

Squid is the most popular Web caching software in use today, and it works on a variety of platforms including Linux, FreeBSD, and Windows. Squid improves network performance by reducing the amount of......一起来看看 《Squid: The Definitive Guide》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

MD5 加密
MD5 加密

MD5 加密工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换