1、签名了app,push apk 到/system/app下(push前需要mount下system目录),出现错误说是找不到对应的lib***.so文件:
“Couldn't load WatchDog from loader dalvik.system.PathClassLoader[dexPath=/system/app/FactoryTest.apk,libraryPath=/data/app-lib/com.starnet.factorytest-1]: findLibrary returned null”
解决:把所需要的库(在工程libs/armeabi目录下的.so文件)push到/system/lib/下即可。
而对于安装到/data/app(正常安装)目录下的app不需要手动push所需要的so文件,也不会出现错误。
2、我的工程有三个.c文件,设置了生成对应的.so文件
Android.mk文件:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
TARGET_PLATFORM := android-3
LOCAL_MODULE := WatchDog
LOCAL_SRC_FILES := WatchDog.c
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
TARGET_PLATFORM := android-3
LOCAL_MODULE := Led
LOCAL_SRC_FILES := Led.c
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
TARGET_PLATFORM := android-3
LOCAL_MODULE := SerialPort
LOCAL_SRC_FILES := SerialPort.c
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
若是只生成一个.so文件,只要:
Android.mk文件:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
TARGET_PLATFORM := android-3
LOCAL_MODULE := FactoryTest
LOCAL_SRC_FILES := WatchDog.c Led.c SerialPort.c
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
即可。
3、对于libs下的armeabi、armeabi-v7a、x68文件夹(没有可以手动添加)、默认下是只编译armeabi的。若是要全部编译,只要在jni文件夹下添加application.mk文件:
Application.mk文件:
APP_ABI := armeabi armeabi-v7a x86
即可。。。