Tencent / tinker

Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstall apk.
Other
17.17k stars 3.34k forks source link

构建patch时, 修改了android.buildConfig.buildConfigField, 抛出UTFDataFormatException #1356

Closed youthyJJ closed 4 years ago

youthyJJ commented 4 years ago

是否有相关issue: 暂未找到类似issue issue描述:

  1. 在打包基础包时, 在Gradle中配置了buildConfigField, 成功打包
  2. 将tinker生成的apk和res mapping文件保存
  3. 添加基础包信息到tinker中, 并且修改了buildConfigField的信息(未改变属性名称)
  4. 执行tinkerPatchDebug任务
  5. 编译出现异常,异常详情请查看日志

异常类型:编译异常 手机型号:编译阶段,未在手机端运行 手机系统版本:编译异常 tinker版本:如:1.9.14.3 gradle版本:gradle-wrapper(gradle-5.6.4-all.zip) / com.android.tools.build(3.6.1) 是否使用热更新SDK: 暂未使用 系统:Mac

堆栈/日志:

./gradlew clean :MiddleWareTest:tinkerPatchDebug --stacktrace
Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :MiddleWareTest
reflectDexArchiveFlag error: ENABLE_DEX_ARCHIVE.
----------------------tinker build warning ------------------------------------
tinker auto operation: 
excluding annotation processor and source template from app packaging. Enable dx jumboMode to reduce package size.
enable dx jumboMode to reduce package size.
disable preDexLibraries to prevent ClassDefNotFoundException when your app is booting.
disable archive dex mode so far for keeping dex apply.

tinker will change your build configs:
we will add TINKER_ID=ba6252e in your build output manifest file build/intermediates/manifests/full/*

if minifyEnabled is true
you will find the gen proguard rule file at build/intermediates/tinker_intermediates/tinker_proguard.pro
and we will help you to put it in the proguardFiles.

if multiDexEnabled is true
you will find the gen multiDexKeepProguard file at build/intermediates/tinker_intermediates/tinker_multidexkeep.pro
and we will help you to put it in the MultiDexKeepProguardFile.

if applyResourceMapping file is exist
we will build MiddleWareTest apk with resource R.txt /Users/youthyj/Desktop/TinkerTest/resmapping.txt file
if resources.arsc has changed, you should use applyResource mode to build the new apk!
-----------------------------------------------------------------
can't get multiDexKeepProguard file
can't get multiDexKeepProguard file

> Task :MiddleWareTest:tinkerProcessDebugManifest
tinker add tinker_id_ba6252e to your AndroidManifest.xml /Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/intermediates/merged_manifests/debug/AndroidManifest.xml
tinker add com.xiaoma.test.MiddleWareTestApp to dex loader pattern
tinker add com.tencent.tinker.loader.* to dex loader pattern
tinker gen AndroidManifest.xml in build/intermediates/tinker_intermediates/AndroidManifest.xml

> Task :XMMiddleWareLibs:XMHotfix:compileDebugJavaWithJavac
Gradle may disable incremental compilation as the following annotation processors are not incremental: jetified-tinker-android-anno-1.9.14.3.jar (com.tencent.tinker:tinker-android-anno:1.9.14.3).
Consider setting the experimental feature flag android.enableSeparateAnnotationProcessing=true in the gradle.properties file to run annotation processing in a separate task and make compilation incremental.
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。

> Task :MiddleWareTest:tinkerProcessDebugResourceId
we build MiddleWareTest apk with apply resource mapping file /Users/youthyj/Desktop/TinkerTest/resmapping.txt

> Task :MiddleWareTest:processDebugResources
tinker add additionalParameters --stable-ids /Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/intermediates/tinker_intermediates/public.txt

> Task :MiddleWareTest:compileDebugJavaWithJavac
Gradle may disable incremental compilation as the following annotation processors are not incremental: jetified-tinker-android-anno-1.9.14.3.jar (com.tencent.tinker:tinker-android-anno:1.9.14.3).
Consider setting the experimental feature flag android.enableSeparateAnnotationProcessing=true in the gradle.properties file to run annotation processing in a separate task and make compilation incremental.
注: Creating file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/generated/ap_generated_sources/debug/out/com/xiaoma/test/MiddleWareTestApp.ava

> Task :MiddleWareTest:tinkerPatchDebug
-----------------------Tinker patch begin-----------------------
configuration: 
oldApk:/Users/youthyj/Desktop/TinkerTest/base.apk
newApk:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/debug/MiddleWareTest-debug.apk
outputFolder:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug
isIgnoreWarning:false
isAllowLoaderClassInAnyDex:true
isRemoveLoaderForAllDex:true
isProtectedApp:false
7-ZipPath:/usr/local/bin/7za
useSignAPk:true
package meta fields: 
dex configs: 
dexMode: raw
dexPattern:classes.*\.dex
dexPattern:assets/secondary-dex-.\.jar
dex loader:com.xiaoma.test.MiddleWareTestApp
dex loader:com.tencent.tinker.loader.*
lib configs: 
libPattern:lib/.*/.*\.so
resource configs: 
resPattern:AndroidManifest\.xml
resPattern:assets/.*
resPattern:res/.*
resPattern:resources\.arsc
largeModSize:100kb
useApplyResource:true
ArkHot: arkHot / patch.apk

config: arkHot patch.apkassets/arkHot_meta.txt
Analyze old and new apk files1:
old apk1131: base.apk, size=3131279, md5=5944cfdb2aa9c02c0b4da5d026c03924
new apk: MiddleWareTest-debug.apk, size=3131284, md5=c944a021ec6f2ba0315b7de261f7ff22

Manifest has no changes, skip rest decode works.
UnZipping apk to /Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/base
UnZipping apk to /Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/MiddleWareTest-debug
Check for loader classes in dex: classes18.dex
Check for loader classes in dex: classes9.dex
Check for loader classes in dex: classes8.dex
Check for loader classes in dex: classes19.dex
Check for loader classes in dex: classes22.dex
Check for loader classes in dex: classes21.dex
Check for loader classes in dex: classes20.dex
Check for loader classes in dex: classes11.dex
Check for loader classes in dex: classes10.dex
Check for loader classes in dex: classes12.dex
Check for loader classes in dex: classes3.dex
Check for loader classes in dex: classes2.dex
loader classes are found in old secondary dex. Found classes: {Lcom/tencent/tinker/loader/R;,Lcom/xiaoma/test/MiddleWareTestApp;}
Check for loader classes in dex: classes13.dex
Check for loader classes in dex: classes.dex
Check for loader classes in dex: classes17.dex
Check for loader classes in dex: classes6.dex
Check for loader classes in dex: classes7.dex
Check for loader classes in dex: classes16.dex
Check for loader classes in dex: classes14.dex
Check for loader classes in dex: classes5.dex
Check for loader classes in dex: classes4.dex
Check for loader classes in dex: classes15.dex

Gen classes2.dex patch file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tinker_result/classes2.dex, size:24188, md5:7164c7461f678d0109288dedc10393f7
Verifying if patched new dex is logically the same as original new dex: MiddleWareTest-debug/classes2.dex ...

Gen classes2.dex for dalvik full dex file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tempPatchedDexes/classes2.dex, size:695192, md5:4b2d2ede7af50588d8b967dacad68ff1

Do additional diff on every dex to remove loader classes in it, because removeLoaderForAllDex = true

Gen classes18.dex patch file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tinker_result/classes18.dex, size:149, md5:38d2e89e25e458c1a2343b176075f486
Verifying if patched new dex is logically the same as original new dex: MiddleWareTest-debug/classes18.dex ...

Gen classes18.dex for dalvik full dex file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tempPatchedDexes/classes18.dex, size:2036, md5:1ceb1a31f7133644b2f8cbc818addb56
DexDecoder:write meta file data: classes18.dex,,1ceb1a31f7133644b2f8cbc818addb56,1ceb1a31f7133644b2f8cbc818addb56,38d2e89e25e458c1a2343b176075f486,1061366446,179436953,raw

Do additional diff on every dex to remove loader classes in it, because removeLoaderForAllDex = true

Gen classes9.dex patch file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tinker_result/classes9.dex, size:149, md5:077e5dc605f2ec31f9fa7293f94638b3
Verifying if patched new dex is logically the same as original new dex: MiddleWareTest-debug/classes9.dex ...

Gen classes9.dex for dalvik full dex file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tempPatchedDexes/classes9.dex, size:2060, md5:3edb7232f7278c59858da8d78500dd54
DexDecoder:write meta file data: classes9.dex,,3edb7232f7278c59858da8d78500dd54,3edb7232f7278c59858da8d78500dd54,077e5dc605f2ec31f9fa7293f94638b3,1220545239,1275977498,raw

Do additional diff on every dex to remove loader classes in it, because removeLoaderForAllDex = true

Gen classes8.dex patch file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tinker_result/classes8.dex, size:149, md5:307ed8c5059757e729800884a4dc0b7e
Verifying if patched new dex is logically the same as original new dex: MiddleWareTest-debug/classes8.dex ...

Gen classes8.dex for dalvik full dex file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tempPatchedDexes/classes8.dex, size:2052, md5:51e37519b502da72353a36bc6c753e03
DexDecoder:write meta file data: classes8.dex,,51e37519b502da72353a36bc6c753e03,51e37519b502da72353a36bc6c753e03,307ed8c5059757e729800884a4dc0b7e,2271896239,2177663635,raw

Do additional diff on every dex to remove loader classes in it, because removeLoaderForAllDex = true

Gen classes19.dex patch file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tinker_result/classes19.dex, size:149, md5:824cacf38050c0287c136b626ae7e7b9
Verifying if patched new dex is logically the same as original new dex: MiddleWareTest-debug/classes19.dex ...

Gen classes19.dex for dalvik full dex file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tempPatchedDexes/classes19.dex, size:2068, md5:23f8b6be6316cda2315022b287a70267
DexDecoder:write meta file data: classes19.dex,,23f8b6be6316cda2315022b287a70267,23f8b6be6316cda2315022b287a70267,824cacf38050c0287c136b626ae7e7b9,1642731922,1919768535,raw

Do additional diff on every dex to remove loader classes in it, because removeLoaderForAllDex = true

Gen classes22.dex patch file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tinker_result/classes22.dex, size:149, md5:ea324232debc49b746239ff5b7d2f642
Verifying if patched new dex is logically the same as original new dex: MiddleWareTest-debug/classes22.dex ...

Gen classes22.dex for dalvik full dex file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tempPatchedDexes/classes22.dex, size:2052, md5:bd58f38bd6b13b08f6dda9b7ceb00783
DexDecoder:write meta file data: classes22.dex,,bd58f38bd6b13b08f6dda9b7ceb00783,bd58f38bd6b13b08f6dda9b7ceb00783,ea324232debc49b746239ff5b7d2f642,192761625,3362463399,raw

Do additional diff on every dex to remove loader classes in it, because removeLoaderForAllDex = true

Gen classes21.dex patch file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tinker_result/classes21.dex, size:149, md5:d618e680346aec22647b0a8922dfdba9
Verifying if patched new dex is logically the same as original new dex: MiddleWareTest-debug/classes21.dex ...

Gen classes21.dex for dalvik full dex file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tempPatchedDexes/classes21.dex, size:2044, md5:7e5e844d68dd2ff749779a2b9c0e7c10
DexDecoder:write meta file data: classes21.dex,,7e5e844d68dd2ff749779a2b9c0e7c10,7e5e844d68dd2ff749779a2b9c0e7c10,d618e680346aec22647b0a8922dfdba9,1211037868,4007020250,raw

Do additional diff on every dex to remove loader classes in it, because removeLoaderForAllDex = true

Gen classes20.dex patch file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tinker_result/classes20.dex, size:149, md5:3d06cc4e1d522303eae2af49e5e761da
Verifying if patched new dex is logically the same as original new dex: MiddleWareTest-debug/classes20.dex ...

Gen classes20.dex for dalvik full dex file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tempPatchedDexes/classes20.dex, size:2068, md5:b88b75f47f29e7c4a68b95a618bd494b
DexDecoder:write meta file data: classes20.dex,,b88b75f47f29e7c4a68b95a618bd494b,b88b75f47f29e7c4a68b95a618bd494b,3d06cc4e1d522303eae2af49e5e761da,3152910917,249279868,raw

Do additional diff on every dex to remove loader classes in it, because removeLoaderForAllDex = true

Gen classes11.dex patch file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tinker_result/classes11.dex, size:149, md5:d436f40d2f639cedbbd577336d0604b5
Verifying if patched new dex is logically the same as original new dex: MiddleWareTest-debug/classes11.dex ...

Gen classes11.dex for dalvik full dex file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tempPatchedDexes/classes11.dex, size:1328, md5:99fe9a6d173577ba174767721da77f3f
DexDecoder:write meta file data: classes11.dex,,99fe9a6d173577ba174767721da77f3f,99fe9a6d173577ba174767721da77f3f,d436f40d2f639cedbbd577336d0604b5,1557594571,403557146,raw

Do additional diff on every dex to remove loader classes in it, because removeLoaderForAllDex = true

Gen classes10.dex patch file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tinker_result/classes10.dex, size:149, md5:ce709635a20fdf078147618efd843c0c
Verifying if patched new dex is logically the same as original new dex: MiddleWareTest-debug/classes10.dex ...

Gen classes10.dex for dalvik full dex file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tempPatchedDexes/classes10.dex, size:2108, md5:9b6fda236285729448558f82774d0ad3
DexDecoder:write meta file data: classes10.dex,,9b6fda236285729448558f82774d0ad3,9b6fda236285729448558f82774d0ad3,ce709635a20fdf078147618efd843c0c,3804125115,1788362300,raw

Do additional diff on every dex to remove loader classes in it, because removeLoaderForAllDex = true

Gen classes12.dex patch file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tinker_result/classes12.dex, size:149, md5:9d1a846d8099ae11e26064fa1ac1c423
Verifying if patched new dex is logically the same as original new dex: MiddleWareTest-debug/classes12.dex ...

Gen classes12.dex for dalvik full dex file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tempPatchedDexes/classes12.dex, size:2160, md5:404175a5d6cf5e3f53cb96dbc5a48e3e
DexDecoder:write meta file data: classes12.dex,,404175a5d6cf5e3f53cb96dbc5a48e3e,404175a5d6cf5e3f53cb96dbc5a48e3e,9d1a846d8099ae11e26064fa1ac1c423,694701324,3118242545,raw

Do additional diff on every dex to remove loader classes in it, because removeLoaderForAllDex = true

Gen classes3.dex patch file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tinker_result/classes3.dex, size:149, md5:f96a4c10b6c39d71b9b71b2505788024
Verifying if patched new dex is logically the same as original new dex: MiddleWareTest-debug/classes3.dex ...

Gen classes3.dex for dalvik full dex file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tempPatchedDexes/classes3.dex, size:46092, md5:0d45db7a5a58ad21f42887173b493ff3
DexDecoder:write meta file data: classes3.dex,,0d45db7a5a58ad21f42887173b493ff3,0d45db7a5a58ad21f42887173b493ff3,f96a4c10b6c39d71b9b71b2505788024,199635597,3657097777,raw
DexDecoder:write meta file data: classes2.dex,,4b2d2ede7af50588d8b967dacad68ff1,4b2d2ede7af50588d8b967dacad68ff1,7164c7461f678d0109288dedc10393f7,1291906561,2235524756,raw

Do additional diff on every dex to remove loader classes in it, because removeLoaderForAllDex = true

Gen classes13.dex patch file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tinker_result/classes13.dex, size:149, md5:565c3d308cc1f85a8f055df95054b220
Verifying if patched new dex is logically the same as original new dex: MiddleWareTest-debug/classes13.dex ...

Gen classes13.dex for dalvik full dex file:/Users/youthyj/Code/Android/Java/XMMiddleWare/MiddleWareTest/build/outputs/apk/tinkerPatch/debug/tempPatchedDexes/classes13.dex, size:2208, md5:ba379a8bb854656c0959d3a7f2be4360
DexDecoder:write meta file data: classes13.dex,,ba379a8bb854656c0959d3a7f2be4360,ba379a8bb854656c0959d3a7f2be4360,565c3d308cc1f85a8f055df95054b220,2089414190,1208157968,raw

Do additional diff on every dex to remove loader classes in it, because removeLoaderForAllDex = true
com.tencent.tinker.build.util.TinkerPatchException: com.tencent.tinker.android.dex.DexException: java.io.UTFDataFormatException: String more than 65535 UTF bytes long
        at com.tencent.tinker.build.decoder.DexDiffDecoder.diffDexPairAndFillRelatedInfo(DexDiffDecoder.java:460)
        at com.tencent.tinker.build.decoder.DexDiffDecoder.logDexesToDexMeta(DexDiffDecoder.java:408)
        at com.tencent.tinker.build.decoder.DexDiffDecoder.generatePatchInfoFile(DexDiffDecoder.java:357)
        at com.tencent.tinker.build.decoder.DexDiffDecoder.onAllPatchesEnd(DexDiffDecoder.java:198)
        at com.tencent.tinker.build.decoder.ApkDecoder.patch(ApkDecoder.java:126)
        at com.tencent.tinker.build.patch.Runner.tinkerPatch(Runner.java:65)
        at com.tencent.tinker.build.patch.Runner.run(Runner.java:48)
        at com.tencent.tinker.build.patch.Runner.gradleRun(Runner.java:41)
        at com.tencent.tinker.build.patch.Runner$gradleRun.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
        at com.tencent.tinker.build.gradle.task.TinkerPatchSchemaTask.tinkerPatch(TinkerPatchSchemaTask.groovy:92)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:717)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:684)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:476)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:461)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:444)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:93)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:237)
        at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33)
        at java.util.Optional.orElseGet(Optional.java:267)
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
        at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)
        at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)
        at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)
        at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
        at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
        at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)
        at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
        at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)
        at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)
        at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:208)
        at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:70)
        at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)
        at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
        at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)
        at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
        at java.util.Optional.map(Optional.java:215)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:69)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:47)
        at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:140)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
        at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
        at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
        at java.lang.Thread.run(Thread.java:748)
Caused by: com.tencent.tinker.android.dex.DexException: java.io.UTFDataFormatException: String more than 65535 UTF bytes long
        at com.tencent.tinker.android.dex.StringData.byteCountInDex(StringData.java:59)
        at com.tencent.tinker.build.dexpatcher.algorithms.diff.StringDataSectionDiffAlgorithm.getItemSize(StringDataSectionDiffAlgorithm.java:45)
        at com.tencent.tinker.build.dexpatcher.algorithms.diff.StringDataSectionDiffAlgorithm.getItemSize(StringDataSectionDiffAlgorithm.java:28)
        at com.tencent.tinker.build.dexpatcher.algorithms.diff.DexSectionDiffAlgorithm.simulatePatchOperation(DexSectionDiffAlgorithm.java:426)
        at com.tencent.tinker.build.dexpatcher.DexPatchGenerator.executeAndSaveTo(DexPatchGenerator.java:364)
        at com.tencent.tinker.build.dexpatcher.DexPatchGenerator.executeAndSaveTo(DexPatchGenerator.java:280)
        at com.tencent.tinker.build.decoder.DexDiffDecoder.diffDexPairAndFillRelatedInfo(DexDiffDecoder.java:458)
        ... 109 more
Caused by: java.io.UTFDataFormatException: String more than 65535 UTF bytes long
        at com.tencent.tinker.android.dex.Mutf8.countBytes(Mutf8.java:79)
        at com.tencent.tinker.android.dex.StringData.byteCountInDex(StringData.java:57)
        ... 115 more

The message received from the daemon indicates that the daemon has disappeared.
Build request sent: Build{id=0f747350-bce3-4cb8-9e8a-ec90e031a67d, currentDir=/Users/youthyj/Code/Android/Java/XMMiddleWare}
Attempting to read last messages from the daemon log...
Daemon pid: 17401
  log file: /Users/youthyj/.gradle/daemon/5.6.4/daemon-17401.out.log
----- Last  20 lines from daemon log file - daemon-17401.out.log -----
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
        at java.lang.Thread.run(Thread.java:748)
Caused by: com.tencent.tinker.android.dex.DexException: java.io.UTFDataFormatException: String more than 65535 UTF bytes long
        at com.tencent.tinker.android.dex.StringData.byteCountInDex(StringData.java:59)
        at com.tencent.tinker.build.dexpatcher.algorithms.diff.StringDataSectionDiffAlgorithm.getItemSize(StringDataSectionDiffAlgorithm.java:45)
        at com.tencent.tinker.build.dexpatcher.algorithms.diff.StringDataSectionDiffAlgorithm.getItemSize(StringDataSectionDiffAlgorithm.java:28)
        at com.tencent.tinker.build.dexpatcher.algorithms.diff.DexSectionDiffAlgorithm.simulatePatchOperation(DexSectionDiffAlgorithm.java:426)
        at com.tencent.tinker.build.dexpatcher.DexPatchGenerator.executeAndSaveTo(DexPatchGenerator.java:364)
        at com.tencent.tinker.build.dexpatcher.DexPatchGenerator.executeAndSaveTo(DexPatchGenerator.java:280)
        at com.tencent.tinker.build.decoder.DexDiffDecoder.diffDexPairAndFillRelatedInfo(DexDiffDecoder.java:458)
        ... 109 more
Caused by: java.io.UTFDataFormatException: String more than 65535 UTF bytes long
        at com.tencent.tinker.android.dex.Mutf8.countBytes(Mutf8.java:79)
        at com.tencent.tinker.android.dex.StringData.byteCountInDex(StringData.java:57)
        ... 115 more
Daemon vm is shutting down... The daemon has exited normally or was terminated in response to a user interrupt.
----- End of the daemon log -----

FAILURE: Build failed with an exception.

* What went wrong:
Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.launcher.daemon.client.DaemonDisappearedException: Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)
        at org.gradle.launcher.daemon.client.DaemonClient.handleDaemonDisappearance(DaemonClient.java:242)
        at org.gradle.launcher.daemon.client.DaemonClient.monitorBuild(DaemonClient.java:218)
        at org.gradle.launcher.daemon.client.DaemonClient.executeBuild(DaemonClient.java:180)
        at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:143)
        at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:94)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:56)
        at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:212)
        at org.gradle.launcher.cli.DefaultCommandLineActionFactory$ParseAndBuildAction.execute(DefaultCommandLineActionFactory.java:404)
        at org.gradle.launcher.cli.DefaultCommandLineActionFactory$ParseAndBuildAction.execute(DefaultCommandLineActionFactory.java:376)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:38)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:23)
        at org.gradle.launcher.cli.DefaultCommandLineActionFactory$WithLogging.execute(DefaultCommandLineActionFactory.java:369)
        at org.gradle.launcher.Main.doAction(Main.java:35)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:31)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:31)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

* Get more help at https://help.gradle.org
youthyJJ commented 4 years ago

补充说明: 修改buildConfigField信息的形式为:

// 基础包中的
android {
        defaultConfig {
            buildConfigField "int", "TINKER_PATCH_VERSION", "0"
        }
    }
// 补丁包中的
android {
        defaultConfig {
            buildConfigField "int", "TINKER_PATCH_VERSION", "1"
        }
    }

即仅修改了值,就会导致前述问题, 是否这个值是不能够修改的?

youthyJJ commented 4 years ago

问题原因已找到: 我定义了一个Gradle方法来方便地更换buildConfigField信息 因为Groovy方法支持入参不给定参数类型,所以偷懒没有定义入参参数的类型 与Tinker应该没有关系, 打扰了 我定义的方法:

def addTinkerPackageInfo(baseVersion, patchVersion, patchMessage) {
    android {
        defaultConfig {
            buildConfigField "String", "TINKER_BASE_VERSION", "\"${baseVersion}\""
            buildConfigField "int", "TINKER_PATCH_VERSION", "${patchVersion}"
            buildConfigField "String", "TINKER_PATCH_MESSAGE", "\"${patchMessage}\""
        }
    }
}

需要修改为:

def addTinkerPackageInfo(String baseVersion, int patchVersion, String patchMessage) {
    android {
        defaultConfig {
            buildConfigField "String", "TINKER_BASE_VERSION", "\"${baseVersion}\""
            buildConfigField "int", "TINKER_PATCH_VERSION", "${patchVersion}"
            buildConfigField "String", "TINKER_PATCH_MESSAGE", "\"${patchMessage}\""
        }
    }
}