andorid 系统添加.so库

Android.mk

 LOCAL_PATH:= $(call my-dir)

 include $(CLEAR_VARS)

 LOCAL_MODULE_TAGS := optional
# LOCAL_SHARED_LIBRARIES := libs/armeabi/libSDL.so \
#                           libs/armeabi/libIAL.so \
#                           libs/armeabi/libbarcodereader44.so \
#                           libs/armeabi/libbarcodereader90.so 
 LOCAL_PREBUILT_LIBS := libs/armeabi/libSDL.so \
                        libs/armeabi/libIAL.so \
                        libs/armeabi/libbarcodereader44.so \
                        libs/armeabi/libbarcodereader90.so 
                                         
 LOCAL_MULTILIB := 32
 include $(BUILD_MULTI_PREBUILT)

 ##########################

 include $(CLEAR_VARS)

 LOCAL_MODULE_TAGS := optional

 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res 
 LOCAL_AAPT_FLAGS := --auto-add-overlay 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)

 LOCAL_PACKAGE_NAME := MyService
 LOCAL_CERTIFICATE := platform
 LOCAL_PRIVILEGED_MODULE := true
 LOCAL_SDK_VERSION := current
 LOCAL_PROGUARD_ENABLED := disabled

 LOCAL_MULTILIB := 32
 include $(BUILD_PACKAGE)

 include $(call all-makefiles-under, $(LOCAL_PATH))

在项目中用到JNI,当用了proguard后,发现native方法找不到很多变量,原来是被produard优化掉了。需要设置 :

LOCAL_PROGUARD_ENABLED := disabled

针对android 选择user版本进行编译的时候,会出现proguard错误,我们需要知道的事情

1.proguard是做什么的,他的作用是将java代码进行混淆的工具

2.因为proguard是混淆工具,所以android的mk文件也对其支持为两种方式:

1.指定不需要混淆的native方法与变量的proguard.flags文件如:LOCAL_PROGUARD_FLAG_FILES := proguard.flags

2.制定编译的工程,不要使用代码混淆的工具进行代码混淆如:LOCAL_PROGUARD_ENABLED := disabled

3.不设置,默认使用LOCAL_PROGUARD_ENABLED := full.即将该工程代码全部混淆

你可能感兴趣的:(系统修改)