I am trying to integrate the Android SerialPort API into my project, but I have some problems with this.
Eclipse does not allow all JNIs and native related methods and fields. This is the beginning of the SerialPort.c Android API SerialPort file:
#include <termios.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <string.h> #include <jni.h> #include "SerialPort.h" #include "android/log.h" static const char *TAG="serial_port"; #define LOGI(fmt, args...) __android_log_print(ANDROID_LOG_INFO, TAG, fmt, ##args) #define LOGD(fmt, args...) __android_log_print(ANDROID_LOG_DEBUG, TAG, fmt, ##args) #define LOGE(fmt, args...) __android_log_print(ANDROID_LOG_ERROR, TAG, fmt, ##args)
The define-statement statement works, but in two other eclipses the markings ANDROID_LOG_DEBUG and ANDROID_LOG_ERROR with Symbol XXX could not be resolved , as well as every call to the JNIEnv *env method inside the serial port methods.
But there are no errors in the JNIEXPORT or JNICALL statements.
The problem arose when I tried to solve this problem. I downloaded all the files for the library and copied them into the directories listed on the website. But it seems that something went wrong with the JNI part, and I could not call open() to get the serial device.
11-19 14:18:22.232: D/dalvikvm(17898): Trying to load lib /data/data/master.androidsirfparser/lib/libserial_port.so 0x416a8570 11-19 14:18:22.232: D/dalvikvm(17898): Added shared lib /data/data/master.androidsirfparser/lib/libserial_port.so 0x416a8570 11-19 14:18:22.232: D/dalvikvm(17898): No JNI_OnLoad found in /data/data/master.androidsirfparser/lib/libserial_port.so 0x416a8570, skipping init 11-19 14:18:22.232: W/dalvikvm(17898): No implementation found for native Lmaster/serial/SerialPort;.open (Ljava/lang/String;II)Ljava/io/FileDescriptor; 11-19 14:18:22.240: W/dalvikvm(17898): threadid=11: thread exiting with uncaught exception (group=0x40a471f8) 11-19 14:18:22.240: E/AndroidRuntime(17898): FATAL EXCEPTION: Thread-651 11-19 14:18:22.240: E/AndroidRuntime(17898): java.lang.UnsatisfiedLinkError: open 11-19 14:18:22.240: E/AndroidRuntime(17898): at master.serial.SerialPort.open(Native Method) 11-19 14:18:22.240: E/AndroidRuntime(17898): at master.serial.SerialPort.<init>(SerialPort.java:61) 11-19 14:18:22.240: E/AndroidRuntime(17898): at master.androidsirfparser.ReadThread.init(ReadThread.java:38) 11-19 14:18:22.240: E/AndroidRuntime(17898): at master.androidsirfparser.ReadThread.run(ReadThread.java:48)
I always get a message about the lack of "not implemented".
I need to solve the problem first in order to work on problem two, because Eclipse does not allow me to run my project without solving the compilation error in the code.
source share