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

编译补丁时出现 Caused by: java.io.UTFDataFormatException: String more than 65535 UTF bytes long 异常 #1403

Closed voisen closed 4 years ago

voisen commented 4 years ago
> Task :app:tinkerPatchDebug
-----------------------Tinker patch begin-----------------------
configuration: 
oldApk:/Users/xxxxxx/Documents/androidDemo/AndroidBanner/AndroidFix/app/build/bakApk/app-debug-0601-16-12-50.apk
newApk:/Users/xxxxxx/Documents/androidDemo/AndroidBanner/AndroidFix/app/build/outputs/apk/debug/app-debug.apk
outputFolder:/Users/xxxxxx/Documents/androidDemo/AndroidBanner/AndroidFix/app/build/outputs/apk/tinkerPatch/debug
isIgnoreWarning:false
isAllowLoaderClassInAnyDex:false
isRemoveLoaderForAllDex:false
isProtectedApp:false
7-ZipPath:/Users/xxxxxx/.gradle/caches/modules-2/files-2.1/com.tencent.mm/SevenZip/1.1.10/cc390e6c704b74496d9ba0e9b46d2cf8a2a96b84/SevenZip-1.1.10-osx-x86_64.exe
useSignAPk:false
package meta fields: 
filed name:patchMessage, filed value:Fixing some bugs !
filed name:platform, filed value:all
filed name:patchVersion, filed value:1.0
dex configs: 
dexMode: jar
dexPattern:assets/secondary-dex-.\.jar
dexPattern:classes.*\.dex
dex loader:com.zhicheng.androidfix.Application
dex loader:com.tencent.tinker.loader.*
lib configs: 
libPattern:lib/.*/.*\.so
resource configs: 
resPattern:res/.*
resPattern:resources\.arsc
resPattern:AndroidManifest\.xml
resPattern:assets/.*
largeModSize:100kb
useApplyResource:true
ArkHot: arkHot / patch.apk

config: arkHot patch.apkassets/arkHot_meta.txt
Analyze old and new apk files1:
old apk1131: app-debug-0601-16-12-50.apk, size=1900752, md5=15f2daed0491207cb38345749b46abab
new apk: app-debug.apk, size=1922063, md5=e559dbc5ade34ff318c2bf94a3db8945

Manifest has no changes, skip rest decode works.
UnZipping apk to /Users/xxxxxx/Documents/androidDemo/AndroidBanner/AndroidFix/app/build/outputs/apk/tinkerPatch/debug/app-debug-0601-16-12-50
UnZipping apk to /Users/xxxxxx/Documents/androidDemo/AndroidBanner/AndroidFix/app/build/outputs/apk/tinkerPatch/debug/app-debug
Check for loader classes in dex: classes2.dex
Check for loader classes in dex: classes.dex
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.generatePatchedDexInfoFile(DexDiffDecoder.java:427)
    at com.tencent.tinker.build.decoder.DexDiffDecoder.generatePatchInfoFile(DexDiffDecoder.java:346)
    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:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    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:386)
    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

Caused by: com.tencent.tinker.android.dex.DexException: java.io.UTFDataFormatException: String more than 65535 UTF bytes long

Caused by: java.io.UTFDataFormatException: String more than 65535 UTF bytes long
coltonliang commented 4 years ago

解决了吗

voisen commented 4 years ago

我的已经解决了, 好像哪点配置错了, 很久以前解决的,你再看一下代码和集成过程

lxxself commented 4 years ago

同整个问题,不知哪里配置做了,还是说哪里的兼容问题,有啥解决思路么

voisen commented 4 years ago

修改一下project的build.gradle这里的gradle版本即可: buildscript { .... dependencies { //修改以下内容, 尤其注意版本号, 不要使用最新版即可 classpath 'com.android.tools.build:gradle:3.5.3' } }

haizhiyun commented 3 years ago

这个可以兼容agp 高版本了么 4.0.+

Domlaa commented 2 years ago

我是下载补丁了,应用补丁的时候报了这个错误,请问有解决方案吗

hamlingong commented 2 years ago

直接使用命令行 hotfix java -jar apktools_20171126_for_714.jar apk1 apk2 result的时候出现了这个问题, 是工具有更新吗