lube / nfc-react-native

69 stars 35 forks source link

No resource found that matches the given name (at 'resource' with value '@xml/nfc_tech_filter') #13

Closed KBepo closed 6 years ago

KBepo commented 7 years ago

Hello,

I've been following instructions and even used example to include this into my project but i keep getting this error:

No resource found that matches the given name (at 'resource' with value '@xml/nfc_tech_filter')

I've made a new folder named xml inside res folder and I've placed nfc_tech_filter.xml from instructions. But can't make it work. What did I miss?

smitch88 commented 7 years ago

I did as the directions stated and it worked for me.

In res/xml

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
  <tech-list>
    <tech>android.nfc.tech.MifareClassic</tech>
  </tech-list>
</resources>

In manifest

<intent-filter>
  <action android:name="android.nfc.action.TECH_DISCOVERED"/>
  </intent-filter>

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

In manifest outside application

<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.INTERNET" />
Mimble-Wimble commented 7 years ago

@smitch88 What did you name the .xml file in app/src/main/res/? I titled mine nfc_tech_filter.xml as KBepo did and I'm getting the same error.

smitch88 commented 7 years ago

@Mimble-Wimble I think you are missing .../xml perhaps. Here is where I have it,

screen shot 2017-07-16 at 10 59 36 am

I also only target a specific set of tag types as an OR by doing something like...if you list them out in a single tech-list it will assume its an AND so unless your tag can identify as all the types it would not work.

screen shot 2017-07-16 at 11 00 24 am
Mimble-Wimble commented 7 years ago

@smitch88 Thanks for this! That's exactly what was needed. Adding the xml/ directory and placing nfc_tech_filter.xml in there resolved the previous error.

henrikra commented 7 years ago

@Mimble-Wimble @KBepo So this can be closed?

Mimble-Wimble commented 7 years ago

@henrikra Yep. All good here.