From e4b56a3fd9733d04000fbb87b4f203d16b0da64b Mon Sep 17 00:00:00 2001 From: shwenzhang Date: Tue, 1 Nov 2016 14:41:51 +0800 Subject: [PATCH] 1. [hotfix] fix dex check error in some case --- README.md | 8 ++++---- gradle.properties | 2 +- .../tencent/tinker/lib/patch/DexDiffPatchInternal.java | 6 +++++- tinker-sample-android/gradle.properties | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0ef3a742..48b74f87 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Tinker [![license](http://img.shields.io/badge/license-BSD3-brightgreen.svg?style=flat)](https://github.com/Tencent/tinker/blob/master/LICENSE) -[![Release Version](https://img.shields.io/badge/release-1.7.2-red.svg)](https://github.com/Tencent/tinker/releases) +[![Release Version](https://img.shields.io/badge/release-1.7.3-red.svg)](https://github.com/Tencent/tinker/releases) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/tinker/pulls) [![WeChat Approved](https://img.shields.io/badge/Wechat_Approved-1.6.2-red.svg)](https://github.com/Tencent/tinker/wiki) @@ -14,7 +14,7 @@ Add tinker-gradle-plugin as a dependency in your main `build.gradle` in the root ```gradle buildscript { dependencies { - classpath ('com.tencent.tinker:tinker-patch-gradle-plugin:1.7.2') + classpath ('com.tencent.tinker:tinker-patch-gradle-plugin:1.7.3') } } ``` @@ -24,9 +24,9 @@ Then you need to "apply" the plugin and add dependencies by adding the following ```gradle dependencies { //optional, help to generate the final application - provided('com.tencent.tinker:tinker-android-anno:1.7.2') + provided('com.tencent.tinker:tinker-android-anno:1.7.3') //tinker's main Android lib - compile('com.tencent.tinker:tinker-android-lib:1.7.2') + compile('com.tencent.tinker:tinker-android-lib:1.7.3') } ... ... diff --git a/gradle.properties b/gradle.properties index 7cbb55f4..89e660e7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,5 +16,5 @@ # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME_PREFIX=1.7.2 +VERSION_NAME_PREFIX=1.7.3 VERSION_NAME_SUFFIX= \ No newline at end of file diff --git a/tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/patch/DexDiffPatchInternal.java b/tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/patch/DexDiffPatchInternal.java index 256c73a8..eb385d90 100644 --- a/tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/patch/DexDiffPatchInternal.java +++ b/tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/patch/DexDiffPatchInternal.java @@ -182,6 +182,10 @@ private static boolean extractDexDiffInternals(Context context, String dir, Stri String dexDiffMd5 = info.dexDiffMd5; String oldDexCrc = info.oldDexCrC; + if (dexDiffMd5.equals("0") && !ShareTinkerInternals.isVmArt()) { + TinkerLog.w(TAG, "patch dex %s is only for art, just continue", patchRealPath); + continue; + } String extractedFileMd5 = ShareTinkerInternals.isVmArt() ? info.destMd5InArt : info.destMd5InDvm; if (!SharePatchFileUtil.checkIfMd5Valid(extractedFileMd5)) { @@ -411,7 +415,7 @@ private static boolean extractDexToJar(ZipFile zipFile, ZipEntry entryFile, File private static void checkVmArtProperty() { boolean art = ShareTinkerInternals.isVmArt(); if (!art && Build.VERSION.SDK_INT >= 21) { - throw new TinkerRuntimeException("it is dalvik vm, but sdk version " + Build.VERSION.SDK_INT + " is larger than 21"); + throw new TinkerRuntimeException("it is dalvik vm, but sdk version " + Build.VERSION.SDK_INT + " is larger than 21!"); } } diff --git a/tinker-sample-android/gradle.properties b/tinker-sample-android/gradle.properties index e608e456..eda0fddb 100644 --- a/tinker-sample-android/gradle.properties +++ b/tinker-sample-android/gradle.properties @@ -17,4 +17,4 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -TINKER_VERSION=1.7.2 +TINKER_VERSION=1.7.3