开发中会存在如下情况,为了防止可能的改动错误,先将要改动的源码备份,新代码有问题时,再还原回原先OK的代码。
如果此时选择仅仅重新build而没有clean,则实际上并没有build原先的代码。
而此时误以为已经还原到原先的代码,就会范很多很傻的错误 ...
这里就是时间戳的问题:只要目标文件比依赖文件(源文件)新,那么就不会重新编译。
比如换回原先的代码,然后执行mmm:
rzzhang@rzzhang-HOME:~/Android/Source$ mmm packages/apps/Settings
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================
make: Entering directory `/home/rzzhang/Android/Source'
make: Nothing to be done for `all_modules'.
make: Leaving directory `/home/rzzhang/Android/Source'
咋办?
要编译的源码里随便找个源文件,改一下,保存,再改回去,OK,重新编译:
rzzhang@rzzhang-HOME:~/Android/Source$ mmm packages/apps/Settings
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================
make: Entering directory `/home/rzzhang/Android/Source'
target Java: Settings (out/target/common/obj/APPS/Settings_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Copying: out/target/common/obj/APPS/Settings_intermediates/classes-jarjar.jar
Copying: out/target/common/obj/APPS/Settings_intermediates/emma_out/lib/classes-jarjar.jar
Copying: out/target/common/obj/APPS/Settings_intermediates/classes.jar
Copying: out/target/common/obj/APPS/Settings_intermediates/noproguard.classes.jar
target Dex: Settings
Copying: out/target/common/obj/APPS/Settings_intermediates/noproguard.classes.dex
target Package: Settings (out/target/product/generic/obj/APPS/Settings_intermediates/package.apk)
(skipping backup file 'packages/apps/Settings/res/values/strings.xml~')
(skipping backup file 'packages/apps/Settings/res/xml/sound_settings.xml~')
'out/target/common/obj/APPS/Settings_intermediates//classes.dex' as 'classes.dex'...
Processing target/product/generic/obj/APPS/Settings_intermediates/package.apk
Done!
Install: out/target/product/generic/system/app/Settings.odex
Install: out/target/product/generic/system/app/Settings.apk
target Java: SettingsTests (out/target/common/obj/APPS/SettingsTests_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/classes-jarjar.jar
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/emma_out/lib/classes-jarjar.jar
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/classes.jar
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/noproguard.classes.jar
target Dex: SettingsTests
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/noproguard.classes.dex
target Package: SettingsTests (out/target/product/generic/obj/APPS/SettingsTests_intermediates/package.apk)
'out/target/common/obj/APPS/SettingsTests_intermediates//classes.dex' as 'classes.dex'...
Processing target/product/generic/obj/APPS/SettingsTests_intermediates/package.apk
Done!
Install: out/target/product/generic/data/app/SettingsTests.odex
Install: out/target/product/generic/data/app/SettingsTests.apk
make: Leaving directory `/home/rzzhang/Android/Source'
(待继续求证于验证 ...)