Android串列埠通訊異常UnsatisfiedLinkError和Please configure your serial port first.
阿新 • • 發佈:2018-12-19
一,異常
使用Google串列埠除錯開源庫App除錯串口出現以下異常:
二,解決辦法:
在Android.mk檔案中加入:LOCAL_LDFLAGS += -fPIC,重新編譯Google開源庫的原始碼,生成.so庫
# # Copyright 2009 Cedric Priscal # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) TARGET_PLATFORM := android-3 LOCAL_MODULE := serial_port LOCAL_SRC_FILES := SerialPort.c LOCAL_LDLIBS := -llog #加入如下資訊 LOCAL_LDFLAGS += -fPIC include $(BUILD_SHARED_LIBRARY)