gpt4 book ai didi

java - Android: list 中无法识别 targetApi

转载 作者:太空宇宙 更新时间:2023-11-03 10:39:11 29 4
gpt4 key购买 nike

我的 list 中有以下行:

<intent-filter  android:autoVerify="true">

但我收到一个 lint 警告:

Attribute autoVerify is only used in API 23 and higher (current min is 16)

所以我将其更改为如下所示(根据 android studio 给我的建议):

<intent-filter  android:autoVerify="true" tools:targetApi="M">

然后我在构建 apk 时收到此错误:

Error:java.lang.RuntimeException: [path_to_manifest]/AndroidManifest.xml:58:13-67:29: Error: Invalid instruction 'targetApi', valid instructions are : REMOVE,REPLACE,STRICT

Caused by: java.lang.IllegalArgumentException: No enum constant com.android.manifmerger.AttributeOperationType.TARGETAPI

如何在消除 lint 警告的同时消除此错误?

编辑:我尝试了“清理项目”和“使缓存无效并重新启动”——都无法解决错误。

在问题跟踪器上打开的问题:

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

最佳答案

我找到了答案 here给出了此问题的解决方法。

通过使用行:

<intent-filter  android:autoVerify="true"
tools:ignore="UnusedAttribute">

lint错误已解决,可以构建apk了。不过,我不会将此标记为已接受的答案 - 我更希望有人可以解释如何使用 targetApi(如果可以使用)?

关于java - Android: list 中无法识别 targetApi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37553946/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com