Skip to content

Commit 696391a

Browse files
committedSep 26, 2016
prepare for Tinker release 1.6.1
1. remove 7zip lib 2. fix Android N error 3. fix Tencent#18 issue
1 parent 7b8a1c3 commit 696391a

File tree

22 files changed

+47
-131
lines changed

22 files changed

+47
-131
lines changed
 

‎README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Tinker
22
[![license](http://img.shields.io/badge/license-BSD3-brightgreen.svg?style=flat)](https://github.com/Tencent/tinker/blob/master/LICENSE)
3-
[![Release Version](https://img.shields.io/badge/release-1.6.0-red.svg)](https://github.com/Tencent/tinker/releases)
3+
[![Release Version](https://img.shields.io/badge/release-1.6.1-red.svg)](https://github.com/Tencent/tinker/releases)
44
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/tinker/pulls)
55

66
Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstalling apk.
@@ -13,7 +13,7 @@ Add tinker-gradle-plugin as a dependency in your main `build.gradle` in the root
1313
```gradle
1414
buildscript {
1515
dependencies {
16-
classpath ('com.tencent.tinker:tinker-patch-gradle-plugin:1.6.0')
16+
classpath ('com.tencent.tinker:tinker-patch-gradle-plugin:1.6.1')
1717
}
1818
}
1919
```
@@ -23,9 +23,9 @@ Then you need to "apply" the plugin and add dependencies by adding the following
2323
```gradle
2424
dependencies {
2525
//optional, help to generate the final application
26-
compile('com.tencent.tinker:tinker-android-anno:1.6.0')
26+
compile('com.tencent.tinker:tinker-android-anno:1.6.1')
2727
//tinker's main Android lib
28-
compile('com.tencent.tinker:tinker-android-lib:1.6.0')
28+
compile('com.tencent.tinker:tinker-android-lib:1.6.1')
2929
}
3030
...
3131
...
@@ -74,6 +74,8 @@ For more tinker configurations, learn more at the sample [app/build.gradle](http
7474
There are some issues which Tinker can't dynamic update.
7575

7676
1. Update AndroidManifest.xml, such as add Android Component.
77+
2. Do not support some Samsung models with os version android-19.
78+
3. Due to Google Play Developer Distribution Agreement, we can't dynamic update our apk.
7779

7880
## Support
7981
Any problem?

‎gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
19-
VERSION_NAME_PREFIX=1.6.0
19+
VERSION_NAME_PREFIX=1.6.1
2020
VERSION_NAME_SUFFIX=

‎settings.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ include ':tinker-android:tinker-android-anno'
55
include ':tinker-build:tinker-patch-cli'
66
include ':tinker-build:tinker-patch-lib'
77
include ':tinker-build:tinker-patch-gradle-plugin'
8-
include ':third-party:seven-zip'
98
include ':third-party:aosp-dexutils'
109
include ':third-party:bsdiff-util'

‎third-party/seven-zip/.gitignore

-1
This file was deleted.

‎third-party/seven-zip/License.txt

-52
This file was deleted.

‎third-party/seven-zip/build.gradle

-49
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

‎third-party/seven-zip/gradle.properties

-2
This file was deleted.

‎tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/service/PatchResult.java

+9-5
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,18 @@ public String toString() {
4949
sb.append("isSuccess:" + isSuccess + "\n");
5050
sb.append("rawPatchFilePath:" + rawPatchFilePath + "\n");
5151
sb.append("costTime:" + costTime + "\n");
52-
sb.append("patchVersion:" + patchVersion + "\n");
53-
sb.append("patchTinkerID:" + patchTinkerID + "\n");
54-
sb.append("baseTinkerID:" + baseTinkerID + "\n");
52+
if (patchVersion != null) {
53+
sb.append("patchVersion:" + patchVersion + "\n");
54+
}
55+
if (patchTinkerID != null) {
56+
sb.append("patchTinkerID:" + patchTinkerID + "\n");
57+
}
58+
if (baseTinkerID != null) {
59+
sb.append("baseTinkerID:" + baseTinkerID + "\n");
60+
}
5561

5662
if (e != null) {
5763
sb.append("Throwable:" + e.getMessage() + "\n");
58-
} else {
59-
sb.append("Throwable: null" + "\n");
6064
}
6165
return sb.toString();
6266
}

‎tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/TinkerInstaller.java

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class TinkerInstaller {
4545
*/
4646
public static void install(ApplicationLike applicationLike) {
4747
Tinker tinker = new Tinker.Builder(applicationLike.getApplication()).build();
48+
Tinker.create(tinker);
4849
tinker.install(applicationLike.getTinkerResultIntent());
4950
}
5051

‎tinker-android/tinker-android-loader/src/main/java/com/tencent/tinker/loader/shareutil/ShareConstants.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ public class ShareConstants {
133133
public static final int ERROR_LOAD_PATCH_REWRITE_PATCH_INFO_FAIL = -18;
134134
public static final int ERROR_LOAD_PATCH_UNKNOWN_EXCEPTION = -19;
135135
//resource
136-
public static final int ERROR_LOAD_PATCH_VERSION_RESOURCE_DIRECTORY_NOT_EXIST = -21;
137-
public static final int ERROR_LOAD_PATCH_VERSION_RESOURCE_FILE_NOT_EXIST = -22;
138-
public static final int ERROR_LOAD_PATCH_VERSION_RESOURCE_LOAD_EXCEPTION = -23;
139-
public static final int ERROR_LOAD_PATCH_VERSION_RESOURCE_MD5_MISMATCH = -24;
140-
public static final int ERROR_LOAD_PATCH_UNCAUGHT_EXCEPTION = -25;
136+
public static final int ERROR_LOAD_PATCH_VERSION_RESOURCE_DIRECTORY_NOT_EXIST = -20;
137+
public static final int ERROR_LOAD_PATCH_VERSION_RESOURCE_FILE_NOT_EXIST = -21;
138+
public static final int ERROR_LOAD_PATCH_VERSION_RESOURCE_LOAD_EXCEPTION = -22;
139+
public static final int ERROR_LOAD_PATCH_VERSION_RESOURCE_MD5_MISMATCH = -23;
140+
public static final int ERROR_LOAD_PATCH_UNCAUGHT_EXCEPTION = -24;
141141

142142
public static final int ERROR_LOAD_GET_INTENT_FAIL = -10000;
143143

‎tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/aapt/PatchUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public static void generatePublicResourceXml(AaptResourceCollector aaptResourceC
119119
// if (rType.equals(RType.STYLE)) {
120120
String rawName = aaptResourceCollector.getRawName(rDotTxtEntry.name);
121121
if (StringUtil.isBlank(rawName)) {
122-
System.err.println("Blank?" + rDotTxtEntry.name);
122+
// System.err.println("Blank?" + rDotTxtEntry.name);
123123
rawName = rDotTxtEntry.name;
124124
}
125125
publicWriter.println("<public type=\"" + rType + "\" name=\"" + rawName + "\" id=\"" + rDotTxtEntry.idValue + "\" />");

‎tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/decoder/DexDiffDecoder.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ public void onAllPatchesEnd() throws Exception {
212212

213213
relatedInfo.dexDiffFile = dexDiffOut;
214214
relatedInfo.dexDiffMd5 = MD5.getMD5(dexDiffOut);
215+
Logger.d("\nGen %s patch file:%s, size:%d, md5:%s", dexName, relatedInfo.dexDiffFile.getAbsolutePath(), relatedInfo.dexDiffFile.length(), relatedInfo.dexDiffMd5);
215216

216217
File tempFullPatchedDexFile = new File(tempFullPatchDexPath, dexName);
217218

@@ -238,7 +239,7 @@ public void onAllPatchesEnd() throws Exception {
238239
if (!tempFullPatchedDexFile.exists()) {
239240
throw new TinkerPatchException("can not find the temporary full patched dex file:" + tempFullPatchedDexFile.getAbsolutePath());
240241
}
241-
Logger.e("Gen %s for dalvik full dex file:%s, size:%d, md5:%s", dexName, tempFullPatchedDexFile.getAbsolutePath(), tempFullPatchedDexFile.length(), relatedInfo.newOrFullPatchedMd5);
242+
Logger.d("\nGen %s for dalvik full dex file:%s, size:%d, md5:%s", dexName, tempFullPatchedDexFile.getAbsolutePath(), tempFullPatchedDexFile.length(), relatedInfo.newOrFullPatchedMd5);
242243
} else {
243244
// In this case newDexFile is the same as oldDexFile, but we still
244245
// need to treat it as patched dex file so that the SmallPatchGenerator
@@ -356,7 +357,7 @@ public void onAllPatchesEnd() throws Exception {
356357
throw new TinkerPatchException("can not find the temporary small patched dex file:" + tempSmallPatchInfoFile.getAbsolutePath());
357358
}
358359
relatedInfo.smallPatchedMd5 = MD5.getMD5(tempSmallPatchedFile);
359-
Logger.e("Gen %s for art small dex file:%s, size:%d, md5:%s", dexName, tempSmallPatchedFile.getAbsolutePath(), tempSmallPatchedFile.length(), relatedInfo.smallPatchedMd5);
360+
Logger.d("\nGen %s for art small dex file:%s, size:%d, md5:%s", dexName, tempSmallPatchedFile.getAbsolutePath(), tempSmallPatchedFile.length(), relatedInfo.smallPatchedMd5);
360361

361362
if (relatedInfo.oldMd5.equals(relatedInfo.newMd5)) {
362363
// Unmodified dex, which has no dexDiffFile, and is ignored in dvm environment.
@@ -531,7 +532,7 @@ private void addTestDex() throws IOException {
531532

532533
File dest = new File(config.mTempResultDir + "/" + TEST_DEX_PATH);
533534
FileOperation.copyResourceUsingStream(TEST_DEX_PATH, dest);
534-
Logger.d("Add test install result dex: %s, size:%d", dest.getAbsolutePath(), dest.length());
535+
Logger.d("\nAdd test install result dex: %s, size:%d", dest.getAbsolutePath(), dest.length());
535536
Logger.d("DexDecoder:write test dex meta file data: %s", meta);
536537

537538
metaWriter.writeLineToInfoFile(meta);

‎tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/util/TypedValue.java

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public class TypedValue {
5959
public static final String RES_MANIFEST = "AndroidManifest.xml";
6060
public static final String RES_OUT = "resources_out.zip";
6161
public static final String RES_OUT_7ZIP = "resources_out_7z.zip";
62-
public static final String RES_OUT_MD5_TAG = "%RES_OUT_MD5_TAG%";
6362

6463
public static final int ADD = 1;
6564
public static final int MOD = 2;

‎tinker-sample-android/app/build.gradle

+17-3
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,31 @@ dependencies {
66
compile fileTree(dir: 'libs', include: ['*.jar'])
77
testCompile 'junit:junit:4.12'
88
compile "com.android.support:appcompat-v7:23.1.1"
9-
compile("com.tencent.tinker:tinker-android-lib:${TINKER_VERSION}")
10-
compile("com.tencent.tinker:tinker-android-anno:${TINKER_VERSION}")
9+
compile("com.tencent.tinker:tinker-android-lib:${TINKER_VERSION}") { changing = true }
10+
compile("com.tencent.tinker:tinker-android-anno:${TINKER_VERSION}") { changing = true }
1111
compile "com.android.support:multidex:1.0.1"
1212

13+
//use for local maven test
14+
compile("com.tencent.tinker:tinker-android-loader:${TINKER_VERSION}") { changing = true }
15+
compile("com.tencent.tinker:aosp-dexutils:${TINKER_VERSION}") { changing = true }
16+
compile("com.tencent.tinker:bsdiff-util:${TINKER_VERSION}") { changing = true }
17+
compile("com.tencent.tinker:tinker-commons:${TINKER_VERSION}") { changing = true }
18+
1319
//use to test multiDex
1420
// compile group: 'com.google.guava', name: 'guava', version: '19.0'
1521
// compile "org.scala-lang:scala-library:2.11.7"
1622
}
1723

1824
def gitSha() {
19-
return 'git rev-parse --short HEAD'.execute().text.trim()
25+
try {
26+
String gitRev = 'git rev-parse --short HEAD'.execute().text.trim()
27+
if (gitRev == null) {
28+
throw new GradleException("can't get git rev, you should add git to system path or just input test value, such as 'testTinkerId'")
29+
}
30+
return gitRev
31+
} catch (Exception e) {
32+
throw new GradleException("can't get git rev, you should add git to system path or just input test value, such as 'testTinkerId'")
33+
}
2034
}
2135

2236
def javaVersion = JavaVersion.VERSION_1_7

‎tinker-sample-android/app/src/main/java/tinker/sample/android/app/SampleApplicationLike.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void onBaseContextAttached(Context base) {
8383
MultiDex.install(base);
8484

8585
SampleApplicationContext.application = getApplication();
86-
SampleApplicationContext.context = getApplication().getApplicationContext();
86+
SampleApplicationContext.context = getApplication();
8787
TinkerManager.setTinkerApplicationLike(this);
8888
TinkerManager.initFastCrashProtect();
8989
//should set before tinker is installed

‎tinker-sample-android/gradle.properties

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
1919

20-
TINKER_VERSION=1.6.0
21-
20+
TINKER_VERSION=1.6.1
+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
22
rm -rf ~/.gradle/caches/modules-2/metadata-2.16/descriptors/com.tencent.tinker
33

4+
#rm -rf ~/.m2/repository/com/tencent/tinker
45
#adb push ./app/build/outputs/tinkerPatch/debug/patch_signed_7zip.apk /storage/sdcard0/

0 commit comments

Comments
 (0)
Please sign in to comment.