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

换平台打补丁包报错.(linux打基准包,windows打补丁) #848

Closed icemanstudy closed 6 years ago

icemanstudy commented 6 years ago

Issue/提问须知

在提交issue之前,我们应该先查询是否已经有相关的issue以及常见问题。提交issue时,我们需要写明issue的原因,以及编译或运行过程的日志(加载进程以及Patch进程)。issue需要以下面的格式:

异常类型:app编译异常

tinker版本:1.9.2

gradle版本:3.3

是否使用热更新SDK: 否

系统:linux+windows

日志:
Analyze old and new apk files:
old apk: base.apk, size=39452703, md5=563dc225e838cc1e74ce736fd2a8bd45
new apk: mgtv-prod-release.apk, size=39453787, md5=9eceb2323bef670d1aeac248f7eb263a

Manifest was changed, while there's no any new components added. Make sure if such changes were all you expected.

UnZipping apk to D:\dev\mgtv\mgtv\build\outputs\tinkerPatch\prod\release\base
UnZipping apk to D:\dev\mgtv\mgtv\build\outputs\tinkerPatch\prod\release\mgtv-prod-release
found modify resource: AndroidManifest.xml, but it is AndroidManifest.xml, just ignore!
Found modify resource: assets/channel.ini
Found modify resource: assets/MV3Plugin_Default.ini
Found modify resource: assets/net_retry_local
Found modify resource: assets/serverPublicKey.pem
Found modify resource: assets/WebViewJavascriptBridge.js
Check for loader classes in dex: classes.dex
Warning:ignoreWarning is false, but we found some loader class has been changed in new dex. Such these changes will not take effect!! related classes: {Lcom/tencent/tinker/loader/hotplug/IncrementComponentManager;,Lcom/tencent/ti
nker/loader/shareutil/SharePatchFileUtil;,Lcom/tencent/tinker/loader/shareutil/ShareTinkerInternals;,Lcom/tencent/tinker/loader/hotplug/handler/AMSInterceptHandler;,Lcom/tencent/tinker/loader/shareutil/ShareElfFile;,Lcom/tencent/
tinker/loader/shareutil/ShareSecurityCheck;}
java.lang.RuntimeException: com.tencent.tinker.build.util.TinkerPatchException: some loader class has been changed in new dex. Such these changes will not take effect!! related classes: {Lcom/tencent/tinker/loader/hotplug/Increme
ntComponentManager;,Lcom/tencent/tinker/loader/shareutil/SharePatchFileUtil;,Lcom/tencent/tinker/loader/shareutil/ShareTinkerInternals;,Lcom/tencent/tinker/loader/hotplug/handler/AMSInterceptHandler;,Lcom/tencent/tinker/loader/sh
areutil/ShareElfFile;,Lcom/tencent/tinker/loader/shareutil/ShareSecurityCheck;}
        at com.tencent.tinker.build.decoder.ApkDecoder$ApkFilesVisitor.visitFile(ApkDecoder.java:179)
        at com.tencent.tinker.build.decoder.ApkDecoder$ApkFilesVisitor.visitFile(ApkDecoder.java:138)
        at java.nio.file.Files.walkFileTree(Files.java:2670)
        at java.nio.file.Files.walkFileTree(Files.java:2742)
        at com.tencent.tinker.build.decoder.ApkDecoder.patch(ApkDecoder.java:113)
        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:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at com.tencent.tinker.build.gradle.task.TinkerPatchSchemaTask.tinkerPatch(TinkerPatchSchemaTask.groovy:85)
        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:73)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:632)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:615)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:236)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:228)
        at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: com.tencent.tinker.build.util.TinkerPatchException: some loader class has been changed in new dex. Such these changes will not take effect!! related classes: {Lcom/tencent/tinker/loader/hotplug/IncrementComponentManage
r;,Lcom/tencent/tinker/loader/shareutil/SharePatchFileUtil;,Lcom/tencent/tinker/loader/shareutil/ShareTinkerInternals;,Lcom/tencent/tinker/loader/hotplug/handler/AMSInterceptHandler;,Lcom/tencent/tinker/loader/shareutil/ShareElfF
ile;,Lcom/tencent/tinker/loader/shareutil/ShareSecurityCheck;}
        at com.tencent.tinker.build.util.ExcludedClassModifiedChecker.checkIfExcludedClassWasModifiedInNewDex(ExcludedClassModifiedChecker.java:206)
        at com.tencent.tinker.build.decoder.DexDiffDecoder.patch(DexDiffDecoder.java:136)
        at com.tencent.tinker.build.decoder.UniqueDexDiffDecoder.patch(UniqueDexDiffDecoder.java:39)
        at com.tencent.tinker.build.decoder.ApkDecoder$ApkFilesVisitor.visitFile(ApkDecoder.java:176)
        ... 47 more

FAILURE: Build failed with an exception.

基准包是在linux机器上打的,我把apk,mapping,R3个文件拉下来.在本地windows机器上打补丁包,就遇到上面的错误.我重新放回linux机器打补丁包就没有问题.

sailor1861 commented 6 years ago

各种编译工具环境不一致导致的吧; wiki上, 不是建议,前后两次最好保持环境完全一致;

tys282000 commented 6 years ago

这个问题我们内部也遇到过,不同的平台,甚至是同一平台不同的机器,在proguard、multidex等工具中都会因为某种莫名其妙的随机性导致生成的产物有差别,所以最好限定统一平台编base包和patch包,这样能避免很多问题。