gpt4 book ai didi

java - NfcAdapter.enableReaderMode() 抛出 java.lang.NoClassDefFoundError

转载 作者:行者123 更新时间:2023-11-29 08:47:10 32 4
gpt4 key购买 nike

我在主 Activity 的 onCreate() 方法中有以下代码:

super.mAdapter.enableReaderMode(this, new NfcAdapter.ReaderCallback() {
@Override
public void onTagDiscovered(Tag tag) {
MessageBox.show(Login.this, "onTagDiscovered");
}
}, NfcAdapter.FLAG_READER_NO_PLATFORM_SOUNDS, null);

但这给出了一个 java.lang.NoClassDefFoundError。当我到达此代码时,我已验证没有任何内容为空。

07-03 11:40:20.249    2637-2637/com.complync.complyncmobile E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.complync.complyncmobile.Login$3
at com.complync.complyncmobile.Login.onCreate(Login.java:184)
at android.app.Activity.performCreate(Activity.java:5015)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2031)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2092)
at android.app.ActivityThread.access$600(ActivityThread.java:133)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4794)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)

第 184 行是:

super.mAdapter.enableReaderMode(this, new NfcAdapter.ReaderCallback() {

有人能帮忙吗?

最佳答案

NfcAdapter.ReaderCallback was added in API Level 19 (奇巧)。

如果出现此异常,最可能的解释是您正在测试的设备或模拟器的 API 级别较低。是这样吗?

关于java - NfcAdapter.enableReaderMode() 抛出 java.lang.NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24551032/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com