我从源代码构建AOSP时,试图让proguard混淆我的应用。 在IntelliJ中运行时,使用以下proguard.flags可以正常工作:
-dontwarn org.apache.commons.**
-dontwarn org.chromium.**
-dontwarn org.xwalk.core.**
-keep class **.R
-keep class **.R$* {
<fields>;
}
-keep class org.xwalk.core.** {
*;
}
-keep class org.chromium.** {
*;
}
-keepattributes **
-keep public class org.jsoup.** {
public *;
}
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
但是在使用以下Android.mk文件构建完整系统(包括我的应用程序)时,它无法正常工作:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_JAVA_LIBRARIES := DukaSharedLibrary\
DukaBrowserLibrary\
JsoupBrowserLibrary\
CrossWalkLibrary\
CommonsValidatorLibrary
LOCAL_SRC_FILES := $(call all-subdir-java-files, src)
LOCAL_SRC_FILES += ../../../vendor/duka/CrossWalkCompatibility/org/xwalk/core/internal/R.java
LOCAL_SRC_FILES += ../../../vendor/duka/CrossWalkCompatibility/org/chromium/content/R.java
LOCAL_SRC_FILES += ../../../vendor/duka/CrossWalkCompatibility/org/chromium/ui/R.java
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/res
LOCAL_RESOURCE_DIR += vendor/duka/DukaSharedLibrary/res
LOCAL_RESOURCE_DIR += vendor/duka/DukaBrowserLibrary/res
LOCAL_RESOURCE_DIR += vendor/duka/CrossWalk/res
LOCAL_MANIFEST_FILE := AndroidManifest.xml
LOCAL_PACKAGE_NAME := DukaBrowser
LOCAL_CERTIFICATE := platform
LOCAL_ASSET_DIR := vendor/duka/DukaSharedLibrary/assets
LOCAL_AAPT_FLAGS := --auto-add-overlay
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := JsoupBrowserLibrary:libs/jsoup-1.7.3.jar
include $(BUILD_MULTI_PREBUILT)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := CommonsValidatorLibrary:libs/commons-validator-1.4.0.jar
include $(BUILD_MULTI_PREBUILT)
当查看生成的.odex文件(我为TARGET_BUILD_VARIANT:=用户构建)时,它没有被混淆 - 但它是在IntelliJ中做同样的事情时。
有人能指出我正确的方向吗?
感谢。