- 浏览: 923743 次
- 性别:
- 来自: 上海
最新评论
-
liu149339750:
我勒个去,搜到你的博客了,关注!
Android make脚本简记 -
ihopethatwell:
楼主,这个修改时间有个问题,退出修改界面就不保存设置的时间了, ...
Android中如何修改系统时间(应用程序获得系统权限) -
flyar520:
你好...我也遇到屏幕半屏刷成黑屏的问题...但是我的时在开机 ...
Android横屏状态下返回到壁纸界面屏幕刷新问题 -
flyar520:
你好...我也遇到屏幕半屏刷成黑屏的问题...但是我的时在开机 ...
Android横屏状态下返回到壁纸界面屏幕刷新问题 -
taowayi:
推荐android一键反编译神器 apkdec
Android apk反编译
对于android2.3编译时候选择下面的情况,既可以对dex进行preopt优化了。
如何从apk生成odex
在BoardConfig.mk中加入
# Enable the optimized DEX
WITH_DEXPREOPT=true
或者直接修改system.prop
# ODEX
dalvik.vm.verify-bytecode=true
$ cat buildspec.mk
TARGET_BUILD_VARIANT:=user
TARGET_BUILD_TYPE:=release
编译相关文件:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
build/core/product_config.mk:164
# Hack to make the linux build servers use dexpreopt (emulator-based
# preoptimization). Most engineers don't use this type of target
# ("make PRODUCT-blah-user"), so this should only tend to happen when
# using buildbot.
# TODO: Remove this once host Dalvik preoptimization is working.
ifeq ($(TARGET_BUILD_VARIANT),user)
WITH_DEXPREOPT_buildbot := true
endif
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
build/core/dex_preopt.mk:127
# dexpreoption for binary released jars
# ONLY enabled in custom release
ifeq ($(PARTIAL_BUILD),true)
ifeq ($(WITH_DEXPREOPT),true)
$(foreach m,$(DEXPREOPT_BINARY_RELEASE_BOOT_JARS_MODULES), \
$(eval $(call install-dexpreopt-jars.binary-release,$(m))) \
$(eval DEXPREOPT_BINARY_RELEASE_BOOT_JARS += \
$(TARGET_OUT_JAVA_LIBRARIES)/$(m).jar \
$(TARGET_OUT_JAVA_LIBRARIES)/$(m).odex \
) \
)
endif
endif
# $(1): the input .jar or .apk file
# $(2): the output .odex file
define dexpreopt-one-file
$(hide) $(DEXPREOPT) --dexopt=$(DEXPREOPT_DEXOPT) --build-dir=$(DEXPREOPT_BUILD_DIR) \
--product-dir=$(DEXPREOPT_PRODUCT_DIR) --boot-dir=$(DEXPREOPT_BOOT_JAR_DIR) \
--boot-jars=$(DEXPREOPT_BOOT_JARS) $(DEXPREOPT_UNIPROCESSOR) \
$(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(1)) \
$(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(2))
endef
调用于:
build/core/dex_preopt.mk:111: $$(call dexpreopt-one-file,$$(PRIVATE_DBJ_JAR),$$@)
build/core/package.mk:440: $(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@))
build/core/java_library.mk:121: $(call dexpreopt-one-file,$<,$@)
build/core/prebuilt.mk:82: $(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@))
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
build/core/package.mk:216
ifeq (true,$(WITH_DEXPREOPT))
ifeq (,$(TARGET_BUILD_APPS))
ifneq (,$(LOCAL_SRC_FILES))
ifndef LOCAL_DEX_PREOPT
LOCAL_DEX_PREOPT := true
endif
endif
endif
endif
实际编译时对生成apk的地方:
# Define the rule to build the actual package.
$(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN)
ifeq ($(LOCAL_DEX_PREOPT),true)
# Make sure the boot jars get dexpreopt-ed first
$(LOCAL_BUILT_MODULE): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT)
endif
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries)
ifneq ($(TARGET_BUILD_APPS),)
# Include all resources for unbundled apps.
$(LOCAL_BUILT_MODULE): PRODUCT_AAPT_CONFIG :=
endif
$(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
@echo "target Package: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
$(add-assets-to-package)
ifneq ($(jni_shared_libraries),)
$(add-jni-shared-libs-to-package)
endif
ifneq ($(full_classes_jar),)
$(add-dex-to-package)
endif
$(sign-package) // apk签名
@# Alignment must happen after all other zip operations.
$(align-package)
ifeq ($(LOCAL_DEX_PREOPT),true)// 对apk进行dexpreopt,定义于build/core/dex_preopt.mk
$(hide) rm -f $(patsubst %.apk,%.odex,$@)
$(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@))
$(call dexpreopt-remove-classes.dex,$@)
built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
$(built_odex): $(LOCAL_BUILT_MODULE)
endif
apk签名函数定义于文件:build/core/definitions.mk +1456
# Sign a package using the specified key/cert.
#
define sign-package
$(hide) mv $@ $@.unsigned
$(hide) java -jar $(SIGNAPK_JAR) \
$(PRIVATE_CERTIFICATE) $(PRIVATE_PRIVATE_KEY) $@.unsigned $@.signed
$(hide) mv $@.signed $@
endef
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
./core/main.mk:183: WITH_DEXPREOPT := true
./core/main.mk:246: WITH_DEXPREOPT := true
./core/main.mk:252: ifeq ($(HOST_OS)-$(WITH_DEXPREOPT_buildbot),linux-true)
./core/main.mk:253: WITH_DEXPREOPT := true
183
ifeq (user, $(TARGET_BUILD_VARIANT))
WITH_DEXPREOPT := true
endif
# Bring in dex_preopt.mk
include $(BUILD_SYSTEM)/dex_preopt.mk
246
user_variant := $(filter userdebug user,$(TARGET_BUILD_VARIANT))
enable_target_debugging := true
ifneq (,$(user_variant))
...
# enable dex pre-optimization for all TARGET projects in default to
# speed up device first boot-up
WITH_DEXPREOPT := true
...
# TODO: Remove this and the corresponding block in
# config/product_config.make once host-based Dalvik preoptimization is
# working.
ifneq (true,$(DISABLE_DEXPREOPT))
ifeq ($(HOST_OS)-$(WITH_DEXPREOPT_buildbot),linux-true)
WITH_DEXPREOPT := true
endif
endif
...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
build/core/java_library.mk +68
ifeq (true,$(WITH_DEXPREOPT))
ifeq (,$(TARGET_BUILD_APPS))
ifndef LOCAL_DEX_PREOPT
LOCAL_DEX_PREOPT := true
endif
endif
endif
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
build/core/java_library.mk +68
ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
ifeq (true,$(WITH_DEXPREOPT))
ifeq (,$(TARGET_BUILD_APPS))
ifndef LOCAL_DEX_PREOPT
LOCAL_DEX_PREOPT := true
endif
endif
endif
endif
如何从apk生成odex
在BoardConfig.mk中加入
# Enable the optimized DEX
WITH_DEXPREOPT=true
或者直接修改system.prop
# ODEX
dalvik.vm.verify-bytecode=true
$ cat buildspec.mk
TARGET_BUILD_VARIANT:=user
TARGET_BUILD_TYPE:=release
编译相关文件:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
build/core/product_config.mk:164
# Hack to make the linux build servers use dexpreopt (emulator-based
# preoptimization). Most engineers don't use this type of target
# ("make PRODUCT-blah-user"), so this should only tend to happen when
# using buildbot.
# TODO: Remove this once host Dalvik preoptimization is working.
ifeq ($(TARGET_BUILD_VARIANT),user)
WITH_DEXPREOPT_buildbot := true
endif
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
build/core/dex_preopt.mk:127
# dexpreoption for binary released jars
# ONLY enabled in custom release
ifeq ($(PARTIAL_BUILD),true)
ifeq ($(WITH_DEXPREOPT),true)
$(foreach m,$(DEXPREOPT_BINARY_RELEASE_BOOT_JARS_MODULES), \
$(eval $(call install-dexpreopt-jars.binary-release,$(m))) \
$(eval DEXPREOPT_BINARY_RELEASE_BOOT_JARS += \
$(TARGET_OUT_JAVA_LIBRARIES)/$(m).jar \
$(TARGET_OUT_JAVA_LIBRARIES)/$(m).odex \
) \
)
endif
endif
# $(1): the input .jar or .apk file
# $(2): the output .odex file
define dexpreopt-one-file
$(hide) $(DEXPREOPT) --dexopt=$(DEXPREOPT_DEXOPT) --build-dir=$(DEXPREOPT_BUILD_DIR) \
--product-dir=$(DEXPREOPT_PRODUCT_DIR) --boot-dir=$(DEXPREOPT_BOOT_JAR_DIR) \
--boot-jars=$(DEXPREOPT_BOOT_JARS) $(DEXPREOPT_UNIPROCESSOR) \
$(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(1)) \
$(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(2))
endef
调用于:
build/core/dex_preopt.mk:111: $$(call dexpreopt-one-file,$$(PRIVATE_DBJ_JAR),$$@)
build/core/package.mk:440: $(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@))
build/core/java_library.mk:121: $(call dexpreopt-one-file,$<,$@)
build/core/prebuilt.mk:82: $(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@))
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
build/core/package.mk:216
ifeq (true,$(WITH_DEXPREOPT))
ifeq (,$(TARGET_BUILD_APPS))
ifneq (,$(LOCAL_SRC_FILES))
ifndef LOCAL_DEX_PREOPT
LOCAL_DEX_PREOPT := true
endif
endif
endif
endif
实际编译时对生成apk的地方:
# Define the rule to build the actual package.
$(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN)
ifeq ($(LOCAL_DEX_PREOPT),true)
# Make sure the boot jars get dexpreopt-ed first
$(LOCAL_BUILT_MODULE): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT)
endif
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries)
ifneq ($(TARGET_BUILD_APPS),)
# Include all resources for unbundled apps.
$(LOCAL_BUILT_MODULE): PRODUCT_AAPT_CONFIG :=
endif
$(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
@echo "target Package: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
$(add-assets-to-package)
ifneq ($(jni_shared_libraries),)
$(add-jni-shared-libs-to-package)
endif
ifneq ($(full_classes_jar),)
$(add-dex-to-package)
endif
$(sign-package) // apk签名
@# Alignment must happen after all other zip operations.
$(align-package)
ifeq ($(LOCAL_DEX_PREOPT),true)// 对apk进行dexpreopt,定义于build/core/dex_preopt.mk
$(hide) rm -f $(patsubst %.apk,%.odex,$@)
$(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@))
$(call dexpreopt-remove-classes.dex,$@)
built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
$(built_odex): $(LOCAL_BUILT_MODULE)
endif
apk签名函数定义于文件:build/core/definitions.mk +1456
# Sign a package using the specified key/cert.
#
define sign-package
$(hide) mv $@ $@.unsigned
$(hide) java -jar $(SIGNAPK_JAR) \
$(PRIVATE_CERTIFICATE) $(PRIVATE_PRIVATE_KEY) $@.unsigned $@.signed
$(hide) mv $@.signed $@
endef
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
./core/main.mk:183: WITH_DEXPREOPT := true
./core/main.mk:246: WITH_DEXPREOPT := true
./core/main.mk:252: ifeq ($(HOST_OS)-$(WITH_DEXPREOPT_buildbot),linux-true)
./core/main.mk:253: WITH_DEXPREOPT := true
183
ifeq (user, $(TARGET_BUILD_VARIANT))
WITH_DEXPREOPT := true
endif
# Bring in dex_preopt.mk
include $(BUILD_SYSTEM)/dex_preopt.mk
246
user_variant := $(filter userdebug user,$(TARGET_BUILD_VARIANT))
enable_target_debugging := true
ifneq (,$(user_variant))
...
# enable dex pre-optimization for all TARGET projects in default to
# speed up device first boot-up
WITH_DEXPREOPT := true
...
# TODO: Remove this and the corresponding block in
# config/product_config.make once host-based Dalvik preoptimization is
# working.
ifneq (true,$(DISABLE_DEXPREOPT))
ifeq ($(HOST_OS)-$(WITH_DEXPREOPT_buildbot),linux-true)
WITH_DEXPREOPT := true
endif
endif
...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
build/core/java_library.mk +68
ifeq (true,$(WITH_DEXPREOPT))
ifeq (,$(TARGET_BUILD_APPS))
ifndef LOCAL_DEX_PREOPT
LOCAL_DEX_PREOPT := true
endif
endif
endif
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
build/core/java_library.mk +68
ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
ifeq (true,$(WITH_DEXPREOPT))
ifeq (,$(TARGET_BUILD_APPS))
ifndef LOCAL_DEX_PREOPT
LOCAL_DEX_PREOPT := true
endif
endif
endif
endif
发表评论
-
Android systrace
2018-09-12 11:13 1035Understanding Systrace Caution: ... -
Android simpleperf
2018-09-12 11:02 1947Introduction of simpleperf What ... -
Android selinux安全策略
2016-06-21 17:16 4108基础知识 SEAndroid在架构和机制上与SELinux完 ... -
Android wifi captive portal 验证
2016-02-23 20:38 5197只要是国内的用户,基本上刷完5.0版本后如果没挂上V P N, ... -
Android CTS windows环境下测试
2015-09-08 11:36 6456Windows下CTS测试步骤 1.获 ... -
Android 之 日期时间 时区同步
2015-05-13 15:47 6369系统设置--日期和时间-- ... -
虚拟按键 振动效果
2015-05-12 11:50 2124[DESCRIPTION] Setting->情景模式- ... -
Android 签名信息读取
2014-08-22 17:32 1381public void getSingInfo() { ... -
Android UiAutomator 自动化测试
2014-07-04 17:39 9993一、一个BUG引发的问题 ... -
Android 多语言 多地区对应表
2014-05-13 17:09 2147Arabic, Egypt (ar_EG) Arabic, ... -
Android emulated sdcard
2013-08-12 21:46 6170如果要添加 emulated sdcard ,需要一下几个 ... -
#if、#ifdef、#if defined之间的区别
2013-05-17 15:19 58471#if的使用说明 #if的后面接的是表达式 #if ( ... -
Android 动态库死机调试方法
2013-03-05 13:54 4873android系统中调试Java非常容易,一般遇到错误都在 ... -
Android sqlite3 详解
2012-09-13 22:13 2406SQLite库包含一个名字叫做sqlite3的命令行,它可以让 ... -
Android 多语言开发
2012-08-16 18:37 2401第一部分 多语言定制的机制 1、ICU4C简介 ICU4 ... -
Android 添加底层核心服务
2012-06-04 10:52 5810为 Android添加底层核 ... -
Android 之响应的系统设置的事件
2012-05-24 18:17 19771、Configuration类专门用于描述手机设备上的配置信 ... -
Android CRT Screen 电视效果
2012-05-17 11:12 2301Android 2.3 对关屏进行了优化,增加了一种类似于 ... -
Android 移动终端camera 防偷*拍设置
2012-04-26 10:35 1893目前市面上的所有移动终端几乎都有camera应用,但andro ... -
Android 浏览器设置中的搜索引擎
2012-04-16 16:37 4679更改浏览器设置中的搜索引擎 1. 需求 将浏览器设 ...
相关推荐
《安卓apk反编译工具——dex-tools-2.1详解》 在移动应用开发领域,尤其是在安卓系统上,了解和分析APK文件的内部结构和代码逻辑是开发者、安全研究人员和逆向工程师的重要任务。"dex-tools-2.1"正是这样一款专为...
"dex-tools-2.1 工具包.zip"是一个专门针对这一需求的工具集,它包含了帮助开发者反编译Java class文件和Android的.dex(Dalvik执行文件)到可读的Java源码的工具。 首先,我们要理解.dex文件的重要性。在Android...
【dex-tools-2.1-SNAPSHOT.zip】是一款用于处理Android应用APK中的DEX(Dalvik Executable)文件的工具集。在Android系统中,DEX文件是包含应用程序代码和资源的二进制格式,它是Dalvik虚拟机执行的指令集。这款工具...
标题 "dex-tools-2.1-SNAPSHOT.rar" 指示的是一个包含与Android应用相关的反编译工具的压缩包。这个工具集主要用于处理Dex文件,这是Android应用程序的主要可执行格式。 Dex-tools 2.1-SNAPSHOT 版本可能是一个开发...
当面临需要定位特定类在哪个.dex文件中的问题时,"Android-dex-finder"就显得非常有用。 "Android-dex-finder"是一个实用的工具,它基于dexlib2库来实现。dexlib2是Maven仓库中的一个开源项目,由Jake Wharton维护...
【标题】"实测可用的dex-tool-2.2"涉及的是Android开发中一个重要的工具——dex2jar,这是版本为2.2的版本。在Android应用开发中,dex文件是Dalvik虚拟机执行的二进制格式,包含了应用程序的所有类和方法。然而,...
`dex-tools`是一个强大的命令行工具集,用于处理和分析Dex文件,它在Android SDK的build-tools目录下可以找到。这个工具的版本为`2.1`,提供了多种功能,帮助开发者进行调试、优化和理解APK的结构。 1. **dx**:这...
安卓dex反编译工具dex-translator-0.0.9.3,使用解压工具先把apk解压得到classes.dex文件,然后执行dex2jar.bat classes.dex,生成classes.dex.dex2jar.jar文件,在用jd-gui.exe打开jar文件就可以看到反编译后的java...
《dex-tools-2.1-20190905-lanchon:安卓逆向与反编译的利器》 在安卓应用开发的世界里,安全性和隐私保护是至关重要的议题。然而,对于开发者而言,有时需要对已有的APK进行分析、调试或者研究,这就涉及到了安卓...
总的来说,"dex-tools-2.1.rar"提供了一个解决“can not merge I and Z”问题的工具,帮助开发者更有效地进行Android应用的逆向工程和调试。通过理解和使用这个工具,开发者可以更深入地理解Dex文件结构,提高工作...
"利用dex-method-counts-master查看app方法数量"这个主题主要涉及到Android应用的Dalvik Executable (DEX) 文件、方法计数、以及如何通过第三方工具进行分析。 首先,了解DEX文件。在Android系统中,Java源代码被...
本文将详细介绍三个常用的APK反编译工具:APKTools、dex2jar(通常与dex-tools一起使用)以及JD-GUI,并讨论它们的功能、使用方法以及在实际操作中的应用。 首先,APKTools是一款由Izzy Soft开发的开源工具,专门...
在Android应用开发领域,了解和使用像dex-tools、JD-GUI和Apktool这样的工具是至关重要的。这些工具可以帮助开发者进行逆向工程、调试和理解APK文件的内部结构。 首先,我们来看"Dex-tools"。Dex是Dalvik ...
总的来说,`dex-method-counts.jar`是一个强大的工具,对于理解和优化Android应用程序的性能和大小非常有用。通过监控APK的方法数量,开发者可以更有效地管理资源,防止因方法数过多而导致的编译错误,并确保应用的...
《dex-tools-2.1.zip:Android应用反编译利器》 在移动应用开发领域,尤其是Android平台,安全性和隐私保护日益重要。开发者们需要理解应用程序的内部运作,或者有时为了学习、调试或逆向工程的目的,需要对APK文件...
Android 反编译工具-dex2jar-2.2,将android的apk反编译为jar形式(classes.dex转化成jar文件),2.0版本已不可用,此处为最新的2.2版本,亲测可用
本资源包含了一系列用于反编译的工具,包括Apktool、dex-tools-2.0以及jd-gui-osx-1.6.6,这些都是开发者和安全研究人员常用的专业工具。 1. **Apktool**: Apktool是由IzzySoft开发的一款开源的Android应用反编译...