0

I am trying to write an Android app where I can read from a COMM port. I am following this tutorial: http://www.java-samples.com/showtutorial.php?tutorialid=11

So, I changed it a bit and took out the main method and replaced it with an OnCreate from an Android activity, but this is where I get weird errors that I don't understand. Can someone please tell me where to look for the errors?

here is the error log:

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)

Thank you :)

dsolimano
  • 8,870
  • 3
  • 48
  • 63
  • The tutorial you linked covers communicating with COMM ports on a *PC* - it doesn't exactly port over to Android. However, you can read [here](http://stackoverflow.com/questions/4621580/using-serial-port-rs-232-in-android) for information on how to read information from USB/serial ports. – Perception Apr 04 '13 at 03:49

1 Answers1

1

javax.comm is not an Android package, and is not ported to Dalvik bytecode. You're SOL.

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