0

我正在尝试编写一个可以从 COMM 端口读取的 Android 应用程序。我正在关注本教程:http ://www.java-samples.com/showtutorial.php?tutorialid=11

因此,我对其进行了一些更改并取出了 main 方法并将其替换为 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)

谢谢 :)

4

1 回答 1

1

javax.comm 不是 Android 包,也没有移植到 Dalvik 字节码。你是索尔。

http://developer.android.com/reference/packages.html

于 2013-04-04T03:02:50.430 回答