我的主要活动的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() {
有人可以帮忙吗?
答案 0 :(得分:0)
NfcAdapter.ReaderCallback
was added in API Level 19(KitKat)。
如果发生此异常,最可能的解释是您正在测试的设备或模拟器的API级别较低。是这样的吗?