【问题标题】:Unsupported type tech-list in Android Studio for NFC tech-filterAndroid Studio 中不支持的类型技术列表用于 NFC 技术过滤器
【发布时间】:2016-10-13 08:48:48
【问题描述】:

在 Eclipse 中,这个 tech-filter.xml 工作正常, 但在 Android Studio 中,它会在编译时出错:

错误:任务“:app:mergeDebugResources”执行失败。 > 项目路径\app\src\main\res\values\tech_filter.xml:错误:不支持的类型“技术列表”

技术过滤器.xml:

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <tech-list>
        <tech>android.nfc.tech.IsoDep</tech>
    </tech-list>
</resources>

AndroidManifest.xml:

<activity android:name=".MainActivity">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.nfc.action.TECH_DISCOVERED"/>
    </intent-filter>
    <meta-data
        android:name="android.nfc.action.TECH_DISCOVERED"
        android:resource="values/tech_filter" />
</activity>

有人遇到过这个问题吗?有什么解决办法吗?

【问题讨论】:

    标签: android xml android-studio nfc intentfilter


    【解决方案1】:

    技术列表不是价值资源。你需要把它放在res/xml/ 下。因此,您的 tech_filter.xml 的路径需要是

    app/src/main/res/xml/tech_filter.xml
    

    它的清单条目如下所示:

    <meta-data
        android:name="android.nfc.action.TECH_DISCOVERED"
        android:resource="@xml/tech_filter" />
    

    【讨论】:

    • @AbrahamPutraPrakasa 太好了。不过,我想知道为什么这会在您的 Eclipse 项目中唤醒...
    猜你喜欢
    • 2011-01-24
    • 1970-01-01
    • 2011-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多