首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >已更新到Android Studio,现在正在接收AAPT:错误:资源属性/类型未找到导航错误

已更新到Android Studio,现在正在接收AAPT:错误:资源属性/类型未找到导航错误
EN

Stack Overflow用户
提问于 2020-03-05 07:26:08
回答 1查看 3K关注 0票数 3

我刚刚更新到Android Studio 3.6.1和最新的gradle版本,现在我的项目将不会构建错误

代码语言:javascript
复制
.gradle/caches/transforms-2/files-2/<some-hash-number>/navigation-common-1.0.0-alpha01/res/values/values.xml:16:5-21-25: AAPT: error: resource attracts/type not found

我试图清除缓存并重新构建,但没有帮助。所以我也尝试了无效缓存和重启,这也没有改变任何事情。不知道还能尝试什么.

编辑:添加Values.xml。

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="NavAction">
        <attr name="android:id"/>
        <attr format="reference" name="destination"/>
        <attr format="boolean" name="launchSingleTop"/>
        <attr format="boolean" name="launchDocument"/>
        <attr format="boolean" name="clearTask"/>
        <attr format="reference" name="popUpTo"/>
        <attr format="boolean" name="popUpToInclusive"/>
        <attr format="reference" name="enterAnim"/>
        <attr format="reference" name="exitAnim"/>
        <attr format="reference" name="popEnterAnim"/>
        <attr format="reference" name="popExitAnim"/>
    </declare-styleable>
    <declare-styleable name="NavArgument">
        <attr name="android:name"/>
        <attr name="android:defaultValue"/>
        <!--free format since in future it could be Parcelable-->
        <attr name="type"/>
    </declare-styleable>
    <declare-styleable name="NavDeepLink">
        <attr format="string" name="uri"/>
        <attr name="android:autoVerify"/>
    </declare-styleable>
    <declare-styleable name="NavGraphNavigator">
        <attr format="reference" name="startDestination"/>
    </declare-styleable>
    <declare-styleable name="Navigator">
        <attr name="android:id"/>
        <attr name="android:label"/>
    </declare-styleable>
</resources>
EN

回答 1

Stack Overflow用户

发布于 2020-03-05 16:19:20

在升级到Android Studio 3.6之后,我也遇到了同样的问题。要解决这个问题,我必须在attrs.xml文件中添加我的自定义视图属性的格式。例如。

代码语言:javascript
复制
<declare-styleable name="TheCustomView">
    <attr name="custom_view_attribute" />
</declare-styleable>

变成了:

代码语言:javascript
复制
<declare-styleable name="TheCustomView">
    <attr name="custom_view_attribute" format="string" />
</declare-styleable>
票数 12
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60536172

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档