更新到Android Studio,现在收到AAPT:error:resource attr/type not found导航错误

更新到Android Studio,现在收到AAPT:error:resource attr/type not found导航错误,android,gradle,aapt,aapt2,Android,Gradle,Aapt,Aapt2,我刚刚更新到Android Studio 3.6.1和最新的gradle版本,现在我的项目不会出现错误 .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 .gradle/caches/transform

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

.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
.gradle/caches/transforms-2/files-2//navigation-common-1.0.0-alpha01/res/values/values.xml:16:5-21-25:AAPT:error:resource/type找不到
我试图清除缓存并重建,但没有帮助。所以我也尝试了一个使缓存失效并重新启动的方法,这也没有改变任何事情。不知道还有什么可以尝试

编辑:Added Values.xml

<?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>

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

<declare-styleable name="TheCustomView">
    <attr name="custom_view_attribute" />
</declare-styleable>

成为:

<declare-styleable name="TheCustomView">
    <attr name="custom_view_attribute" format="string" />
</declare-styleable>


奇怪的是,这是安卓导航库的结果,而不是我自己的自定义视图……仅供参考:这项
格式
要求是由Gradle update(可能从6.1.1和plugin 4.0.0开始)引入的,而不是安卓Studio本身。这与plugin版本3.6.3有关,因此我认为这与此有关。