In Eclipse, this tech-filter.xml works fine, but in Android Studio it gives error at compile time:
Error:Execution failed for task ':app:mergeDebugResources'. > Path-to-project\app\src\main\res\values\tech_filter.xml: Error: Unsupported type 'tech-list'
tech-filter.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>
Has anyone experienced this problem? Is there any solution to this?
The tech-list is not a value resource. You need to put it under res/xml/
instead. Thus, the path of your tech_filter.xml needs to be
app/src/main/res/xml/tech_filter.xml
and the manifest entry for it would look like this:
<meta-data
android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/tech_filter" />