Tinker: 补丁包编译异常 Warning:ignoreWarning is false, but we found loader classes are found in old secondary dex. Found classes:

Created on 9 May 2018  ·  20Comments  ·  Source: Tencent/tinker

异常类型:app编译异常

手机型号:魅族M6

tinker版本:1.9.1

gradle版本:2.14.1

是否使用热更新SDK: Bugly SDK(tinker-support:1.1.1 crashreport_upgrade:1.3.4

系统:windows

堆栈/日志:
Error:com.tencent.tinker.build.util.TinkerPatchException: loader classes are found in old secondary dex. Found classes: {Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SIStub_01;,Lcom/tencent/tinker/loader/shareutil/ShareResPatchInfo;,Lcom/tencent/tinker/loader/SystemClassLoaderAdder$V23;,Lcom/tencent/tinker/loader/hotplug/ActivityStubManager;,Lcom/tencent/tinker/loader/shareutil/ShareOatUtil$1;,Lcom/tencent/tinker/loader/shareutil/ShareOatUtil;,Lcom/tencent/tinker/loader/shareutil/SharePatchFileUtil;,Lcom/tencent/tinker/loader/shareutil/ShareFileLockHelper;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTKStub_04;,Lcom/tencent/tinker/loader/TinkerDexOptimizer$StreamConsumer$1;,Lcom/tencent/tinker/loader/TinkerDexLoader;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$STDStub_06;,Lcom/tencent/bugly/beta/tinker/TinkerPatchReflectApplication;,Lcom/tencent/tinker/loader/TinkerDexOptimizer$1;,Lcom/tencent/tinker/loader/TinkerDexOptimizer$StreamConsumer;,Lcom/tencent/tinker/loader/hotplug/IncrementComponentManager;,Lcom/tencent/tinker/loader/app/DefaultApplicationLike;,Lcom/tencent/tinker/loader/AndroidNClassLoader;,Lcom/tencent/tinker/loader/TinkerResourcesKey;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SIStub_09;,Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTStub_07;,Lcom/tencent/tinker/loader/shareutil/ShareIntentUtil;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SIStub_00;,Lcom/tencent/tinker/loader/TinkerResourcesKey$V24;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTKStub_05;,Lcom/tencent/tinker/loader/TinkerTestAndroidNClassLoader;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$STDStub_01_T;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SIStub_01_T;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTStub_01_T;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$STDStub_07;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTKStub_00_T;,Lcom/tencent/tinker/loader/hotplug/handler/MHMessageHandler;,Lcom/tencent/tinker/loader/shareutil/ShareElfFile$SectionHeader;,Lcom/tencent/tinker/loader/TinkerDexOptimizer$ResultCallback;,Lcom/tencent/tinker/loader/TinkerResourceLoader;,Lcom/tencent/tinker/loader/SystemClassLoaderAdder$V19;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTStub_06;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SIStub_08;,Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor$BinderInvocationHandler;,Lcom/tencent/tinker/loader/shareutil/ShareResPatchInfo$LargeModeInfo;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs;,Lcom/tencent/tinker/loader/TinkerResourcesKey$V19;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTKStub_02;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTStub_09;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$STDStub_00;,Lcom/tencent/tinker/loader/shareutil/ShareElfFile$1;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$STDStub_02_T;,Lcom/tencent/tinker/loader/TinkerTestDexLoad;,Lcom/tencent/tinker/loader/shareutil/ShareElfFile$ProgramHeader;,Lcom/tencent/tinker/loader/TinkerSoLoader;,Lcom/tencent/tinker/loader/hotplug/interceptor/HandlerMessageInterceptor$CallbackWrapper;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTKStub_01_T;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$STDStub_08;,Lcom/tencent/tinker/loader/shareutil/ShareElfFile$ElfHeader;,Lcom/tencent/tinker/loader/app/ApplicationLifeCycle;,Lcom/tencent/tinker/loader/TinkerResourcePatcher;,Lcom/tencent/tinker/loader/shareutil/ShareTinkerInternals;,Lcom/tencent/tinker/loader/hotplug/ComponentHotplug;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SIStub_07;,Lcom/tencent/tinker/loader/TinkerDexOptimizer$OptimizeWorker;,Lcom/tencent/tinker/loader/hotplug/interceptor/InterceptFailedException;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTStub_01;,Lcom/tencent/tinker/loader/BuildConfig;,Lcom/tencent/tinker/loader/TinkerLoader;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTKStub_03;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$STDStub_01;,Lcom/tencent/tinker/loader/SystemClassLoaderAdder$V4;,Lcom/tencent/tinker/loader/hotplug/interceptor/Interceptor$ITinkerHotplugProxy;,Lcom/tencent/tinker/loader/shareutil/ShareSecurityCheck;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$STDStub_09;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTStub_00;,Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor$FakeInterfaceHandler;,Lcom/tencent/tinker/loader/SystemClassLoaderAdder;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTStub_08;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SIStub_06;,Lcom/tencent/tinker/loader/TinkerResourcesKey$V17;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTKStub_00;,Lcom/tencent/tinker/loader/hotplug/interceptor/HandlerMessageInterceptor;,Lcom/tencent/tinker/loader/shareutil/ShareBsDiffPatchInfo;,Lcom/tencent/tinker/loader/shareutil/ShareReflectUtil;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTStub_00_T;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$STDStub_00_T;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$STDStub_02;,Lcom/tencent/tinker/loader/TinkerUncaughtHandler;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SIStub_02_T;,Lcom/tencent/tinker/loader/TinkerDexOptimizer;,Lcom/tencent/tinker/loader/shareutil/ShareConstants;,Lcom/tencent/tinker/loader/shareutil/SharePatchInfo;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTKStub_09;,Lcom/tencent/tinker/loader/hotplug/handler/PMSInterceptHandler;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SIStub_05;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTStub_03;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTKStub_01;,Lcom/tencent/tinker/loader/SystemClassLoaderAdder$V14;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$STDStub_03;,Lcom/tencent/tinker/loader/hotplug/IncrementComponentManager$AttrTranslator;,Lcom/tencent/tinker/loader/shareutil/ShareOatUtil$InstructionSet;,Lcom/tencent/tinker/loader/app/TinkerApplication;,Lcom/tencent/tinker/loader/hotplug/interceptor/ServiceBinderInterceptor$FakeClientBinderHandler;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTStub_02;,Lcom/tencent/tinker/loader/hotplug/UnsupportedEnvironmentException;,Lcom/tencent/tinker/loader/TinkerRuntimeException;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SIStub_04;,Lcom/tencent/tinker/loader/hotplug/interceptor/HandlerMessageInterceptor$MessageHandler;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTKStub_06;,Lcom/tencent/tinker/loader/TinkerDexLoader$1;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SIStub_00_T;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTStub_02_T;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$STDStub_04;,Lcom/tencent/tinker/loader/hotplug/IncrementComponentManager$1;,Lcom/tencent/tinker/loader/hotplug/EnvConsts;,Lcom/tencent/tinker/loader/hotplug/handler/AMSInterceptHandler;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTStub_05;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SIStub_03;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SIStub_02;,Lcom/tencent/tinker/loader/app/ApplicationLike;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTKStub_07;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$STDStub_05;,Lcom/tencent/tinker/loader/AbstractTinkerLoader;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTKStub_02_T;,Lcom/tencent/tinker/loader/SystemClassLoaderAdder$1;,Lcom/tencent/tinker/loader/TinkerResourcesKey$V7;,Lcom/tencent/tinker/loader/shareutil/ShareDexDiffPatchInfo;,Lcom/tencent/tinker/loader/shareutil/ShareElfFile;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTKStub_08;,Lcom/tencent/tinker/loader/hotplug/ActivityStubs$SGTStub_04;,Lcom/tencent/tinker/loader/hotplug/interceptor/Interceptor;}
原来的项目没有遇到这个问题,新集成的这个一直有问题 不知道什么情况 请大神帮忙下

Most helpful comment

minVersion 19仍然有这个问腿

直接在tinker-support.gradle的tinkerSupport层加上ignoreWarning = true试试

All 20 comments

bugly最高支持的好像只是1.9.1

bugly更新到了支持1.9.6,但是还会出现这个问题

minSdkVersion是21会报错 19就没问题

我之前直接接入的tinker没问题,这两天改成bugly集成后也出现了同样的问题

@CMonoceros 我试了下,确实19可以,21的classes2里面还是有tinker的类

minSdkVersion为21就无解了?

我改成20了

我也遇到这个,更奇怪的是前几个版本都没问题,这个版本就出错了,好烦

我这几天也遇到了这个问题,以前好好地,求解决方法

我也遇到了这个问题,解决方法写在了 https://blog.csdn.net/qq_29870299/article/details/84194002

minVersion 19仍然有这个问腿

直接在tinker-support.gradle的tinkerSupport层加上ignoreWarning = true试试

我也遇到了这个问题,解决方法写在了 https://blog.csdn.net/qq_29870299/article/details/84194002

——————————————————————————————————————————————
我用了你的方法,不过还有这个问题:
Manifest has no changes, skip rest decode works.
UnZipping apk to E:\Project\FolksLegend\app\build\outputs\apk\tinkerPatch\release\app-release
UnZipping apk to E:\Project\FolksLegend\app\build\outputs\apk\tinkerPatch\release\FolksLegend-2000
Check for loader classes in dex: classes.dex
Check for loader classes in dex: classes2.dex
Check for loader classes in dex: classes3.dex
Warning:ignoreWarning is false, but we found loader classes are found in old secondary dex. Found classes: {Lcom/tencent/tinker/loader/app/DefaultApplicationLike;,Lcom/tencent/tinker/loader/app/ApplicationLike;,Lcom/tencent/bugly/beta/tinker/TinkerPatchReflectApplication;,Lcom/tencent/tinker/loader/app/ApplicationLifeCycle;}
java.lang.RuntimeException: com.tencent.tinker.build.util.TinkerPatchException: loader classes are found in old secondary dex. Found classes: {Lcom/tencent/tinker/loader/app/DefaultApplicationLike;,Lcom/tencent/tinker/loader/app/ApplicationLike;,Lcom/tencent/bugly/beta/tinker/TinkerPatchReflectApplication;,Lcom/tencent/tinker/loader/app/ApplicationLifeCycle;}
at com.tencent.tinker.build.decoder.ApkDecoder$ApkFilesVisitor.visitFile(ApkDecoder.java:179)


结合ignoreWarning = true,并且清理了一遍build/output目录以后重新运行buildTinkerPatchRelease任务

用你的方法就打出补丁包了,明明已经输出了

Add YAPATCH.MF into the file: patch_unsigned.apk

但是补丁包里没有YAPATCH.MF 文件,诡异……

更新1.9.9解决了……

@GinRyan 你好,可以发一下你的app.gradle配置吗?我升级了依然无法打出patch包

你是不是直接在AS中点击的Run按钮运行的Base包?然后看包结构Tinker的loader始终在classes2.dex中,有没有尝试在app module下写一个maindexlist.txt,

<<****你自己的Application.class>>
<<*****TinkerApplicationLike.class>>

com/tencent/tinker/loader/hotplug/ActivityStubs$SIStub_01
com/tencent/tinker/loader/shareutil/ShareResPatchInfo
com/tencent/tinker/loader/SystemClassLoaderAdder$V23
com/tencent/tinker/loader/hotplug/ActivityStubManager
com/tencent/tinker/loader/shareutil/ShareOatUtil$1
com/tencent/tinker/loader/shareutil/ShareOatUtil
com/tencent/tinker/loader/shareutil/SharePatchFileUtil
com/tencent/tinker/loader/shareutil/ShareFileLockHelper
com/tencent/tinker/loader/hotplug/ActivityStubs$SGTKStub_04
com/tencent/tinker/loader/TinkerDexOptimizer$StreamConsumer$1
com/tencent/tinker/loader/TinkerDexLoader
com/tencent/tinker/loader/hotplug/ActivityStubs$STDStub_06
.....等等等

然后:【方式1】:

dexOptions {
        jumboMode = true
//        preDexLibraries = false
        javaMaxHeapSize "2g"     //增加java堆内存大小
        additionalParameters = ['--multi-dex','--set-max-idx-number=60000','--main-dex-list='+projectDir+'/maindexlist.txt', '--minimal-main-dex']
        additionalParameters = ['--set-max-idx-number=65000', '--num-threads=4', '--minimal-main-dex']
    }

【方式2】:

buildTypes {

        debug {
            debuggable true
            minifyEnabled false
            multiDexKeepFile file('maindexlist.txt')
//            signingConfig signingConfigs.debug
        }

        release {
            multiDexKeepFile file("maindexlist.txt")
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

_最后发现两个方式都不好用,dex的包中依然把Tinker的load放到了classes2.dex中,最后甚至dexKnife都用上了,还是会报错。_

【我的解决方式如下,核心思想:用命令行去打包!!!!!!举例是debug包】:
1.生成Base包用:./gradlew assembleDebug
2.生成Patch包用:./gradlew tinkerPatchDebug
ps:1.7.6版本后的话,不用刻意去设置app下build.gradle中的loader;

ps:另外,注意手机读写动态权限的申请!!!否则会让你很挠头,找不到问题所在。

ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},12); //8.0需要动态权限申请

最近也遇到了,你们怎么解决的?

最近也遇到了,你们怎么解决的?

我也遇到了,不知道你解决了吗

如果项目的minSdkVersion>=21,升级到1.9.14并开启allowLoaderInAnyDexremoveLoaderForAllDex选项就能规避这个问题了。

如果项目的minSdkVersion>=21,升级到1.9.14并开启allowLoaderInAnyDexremoveLoaderForAllDex选项就能规避这个问题了。

请问allowLoaderInAnyDex。removeLoaderForAllDex 这两个配置项在哪?

更新1.9.9解决了……

Was this page helpful?
0 / 5 - 0 ratings