Android Sample CardReader崩溃了

时间:2014-04-03 21:46:08

标签: java android eclipse

我终于编译了没有错误的读卡器的android示例(SDK 4.4.2),但是当我在我的Samsung S4(Android 4.4.2)上运行它时它会立即崩溃!有没有人 知道原因和解决方案吗? 那是读卡器:

https://developer.android.com/samples/CardReader/index.html

我还有一台Nexus 7,应用程序崩溃了!这是logcat:

04-03 23:38:23.280: D/AndroidRuntime(2493): Shutting down VM
04-03 23:38:23.280: W/dalvikvm(2493): threadid=1: thread exiting with uncaught exception (group=0x41f07ba8)
04-03 23:38:23.280: E/AndroidRuntime(2493): FATAL EXCEPTION: main
04-03 23:38:23.280: E/AndroidRuntime(2493): Process: com.example.nfctest, PID: 2493
04-03 23:38:23.280: E/AndroidRuntime(2493): java.lang.RuntimeException: Unable to start     activity ComponentInfo{com.example.nfctest/com.example.nfctest.MainActivity}: android.view.InflateException: Binary XML file line #45: Error inflating class fragment
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.os.Handler.dispatchMessage(Handler.java:102)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.os.Looper.loop(Looper.java:136)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.app.ActivityThread.main(ActivityThread.java:5017)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at java.lang.reflect.Method.invokeNative(Native Method)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at java.lang.reflect.Method.invoke(Method.java:515)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at dalvik.system.NativeStart.main(Native Method)
04-03 23:38:23.280: E/AndroidRuntime(2493): Caused by: android.view.InflateException: Binary XML file line #45: Error inflating class fragment
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.app.Activity.setContentView(Activity.java:1929)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at com.example.nfctest.MainActivity.onCreate(MainActivity.java:47)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.app.Activity.performCreate(Activity.java:5231)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
04-03 23:38:23.280: E/AndroidRuntime(2493):     ... 11 more
04-03 23:38:23.280: E/AndroidRuntime(2493): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.example.common.logger.LogFragment: make sure class name exists, is public, and has an empty constructor that is public
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.app.Fragment.instantiate(Fragment.java:597)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.app.Fragment.instantiate(Fragment.java:561)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.app.Activity.onCreateView(Activity.java:4778)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
04-03 23:38:23.280: E/AndroidRuntime(2493):     ... 22 more
04-03 23:38:23.280: E/AndroidRuntime(2493): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.common.logger.LogFragment" on path: DexPathList[[zip file "/data/app/com.example.nfctest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.nfctest-1, /vendor/lib, /system/lib]]
04-03 23:38:23.280: E/AndroidRuntime(2493):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
04-03 23:38:23.280: E/AndroidRuntime(2493):     at android.app.Fragment.instantiate(Fragment.java:583)
04-03 23:38:23.280: E/AndroidRuntime(2493):     ... 25 more

0 个答案:

没有答案