无法导入android.nfc.NfcAdapter

时间:2019-12-12 07:25:38

标签: android nfc

我正在尝试在项目中导入android.nfc.NfcAdapter类,但Android Studio无法看到它。这些是我的依赖项:

dependencies {
    implementation 'com.github.TangemCash:card-common:v0.2.2'
    implementation 'com.github.TangemCash:card-android:v0.2.2'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
    implementation 'androidx.core:core-ktx:1.1.0-alpha05'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

这是我的清单:

        <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="@xml/nfc_tech_filter" />

        </activity>

还有nfc_tech_filter.xml

<resources>
    <tech-list>
        <tech>android.nfc.tech.IsoDep</tech>
        <tech>android.nfc.tech.Ndef</tech>
    </tech-list>
</resources>

我不确定下一步该怎么做。每当我尝试导入Unresolved reference nfc时,Idea都会说android.nfc.NfcAdapter,这是怎么回事?

0 个答案:

没有答案