0
我想寫一個Android應用程序,我可以從COMM端口讀取。我正在關注這個教程:http://www.java-samples.com/showtutorial.php?tutorialid=11Javax.comm錯誤
所以,我改變了一下,拿出了主要方法,並用一個Android活動的OnCreate取代了它,但這是我得到我不明白的奇怪錯誤的地方。有人可以告訴我在哪裏尋找錯誤?
這裏是錯誤日誌:
04-04 02:26:43.426: E/AndroidRuntime(1418): FATAL EXCEPTION: main
04-04 02:26:43.426: E/AndroidRuntime(1418): java.lang.NoClassDefFoundError: javax.comm.CommPortIdentifier
04-04 02:26:43.426: E/AndroidRuntime(1418): at com.example.jovialjavauart.Reader.onCreate(Reader.java:27)
04-04 02:26:43.426: E/AndroidRuntime(1418): at android.app.Activity.performCreate(Activity.java:5104)
04-04 02:26:43.426: E/AndroidRuntime(1418): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
04-04 02:26:43.426: E/AndroidRuntime(1418): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
04-04 02:26:43.426: E/AndroidRuntime(1418): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
04-04 02:26:43.426: E/AndroidRuntime(1418): at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-04 02:26:43.426: E/AndroidRuntime(1418): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
04-04 02:26:43.426: E/AndroidRuntime(1418): at android.os.Handler.dispatchMessage(Handler.java:99)
04-04 02:26:43.426: E/AndroidRuntime(1418): at android.os.Looper.loop(Looper.java:137)
04-04 02:26:43.426: E/AndroidRuntime(1418): at android.app.ActivityThread.main(ActivityThread.java:5039)
04-04 02:26:43.426: E/AndroidRuntime(1418): at java.lang.reflect.Method.invokeNative(Native Method)
04-04 02:26:43.426: E/AndroidRuntime(1418): at java.lang.reflect.Method.invoke(Method.java:511)
04-04 02:26:43.426: E/AndroidRuntime(1418): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-04 02:26:43.426: E/AndroidRuntime(1418): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-04 02:26:43.426: E/AndroidRuntime(1418): at dalvik.system.NativeStart.main(Native Method)
謝謝:)
本教程您聯繫蓋與COMM端口* PC *上通信 - 它交給的Android端口不準確。但是,您可以閱讀[這裏](http://stackoverflow.com/questions/4621580/using-serial-port-rs-232-in-android)瞭解如何從USB /串行端口讀取信息。 – Perception 2013-04-04 03:49:19