tinker icon indicating copy to clipboard operation
tinker copied to clipboard

java.util.zip.ZipException: duplicate entry: com/google/gson/Gson$5.class

Open SmallBlueWhale opened this issue 10 years ago • 9 comments

拉取dev分支代码,localmaven后,用的tinker1.74的版本,打补丁的时候,还是会出现了这一个问题。日志和配置的第三方库如下:

以下是tinkerpatchdebug日志 ----------------------tinker build warning ------------------------------------ tinker will change your build configs: we will add TINKER_ID=0d97029 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 you should copy it to your own multiDex keep proguard file yourself.

if applyResourceMapping file is exist we will build enterActivity apk with resource R.txt D:\as_workspace\maizuo4.x\enterActivity\build\bakApk/enterActivity-debug-1111-09-45-24-R.txt file if resources.arsc has changed, you should use applyResource mode to build the new apk!

:enterActivity:preBuild UP-TO-DATE :youkuPlayerOpenSDK:preBuild UP-TO-DATE :youkuPlayerOpenSDK:preReleaseBuild UP-TO-DATE :youkuPlayerOpenSDK:checkReleaseManifest :youkuPlayerOpenSDK:preDebugAndroidTestBuild UP-TO-DATE :youkuPlayerOpenSDK:preDebugBuild UP-TO-DATE :youkuPlayerOpenSDK:preDebugUnitTestBuild UP-TO-DATE :youkuPlayerOpenSDK:preReleaseUnitTestBuild UP-TO-DATE :youkuPlayerOpenSDK:prepareComAndroidSupportSupportCompat2421Library UP-TO-DATE :youkuPlayerOpenSDK:prepareComAndroidSupportSupportCoreUi2421Library :enterActivity:preDebugBuild UP-TO-DATE :enterActivity:checkDebugManifest :youkuPlayerOpenSDK:prepareComAndroidSupportSupportCoreUi2421Library UP-TO-DATE :youkuPlayerOpenSDK:prepareComAndroidSupportSupportCoreUtils2421Library :enterActivity:preDebugAndroidTestBuild UP-TO-DATE :enterActivity:preReleaseBuild UP-TO-DATE :enterActivity:generateDebugBuildConfig :youkuPlayerOpenSDK:prepareComAndroidSupportSupportCoreUtils2421Library UP-TO-DATE :youkuPlayerOpenSDK:prepareComAndroidSupportSupportFragment2421Library UP-TO-DATE :youkuPlayerOpenSDK:prepareComAndroidSupportSupportMediaCompat2421Library :enterActivity:generateDebugBuildConfig UP-TO-DATE :enterActivity:generateDebugResValues UP-TO-DATE :enterActivity:incrementalDebugJavaCompilationSafeguard :youkuPlayerOpenSDK:prepareComAndroidSupportSupportMediaCompat2421Library UP-TO-DATE :youkuPlayerOpenSDK:prepareComAndroidSupportSupportV42421Library :enterActivity:incrementalDebugJavaCompilationSafeguard UP-TO-DATE :enterActivity:compileDebugNdk UP-TO-DATE :enterActivity:mergeDebugShaders UP-TO-DATE :enterActivity:compileDebugShaders UP-TO-DATE :enterActivity:generateDebugAssets UP-TO-DATE try update tinker multidex keep proguard file with D:\as_workspace\maizuo4.x\enterActivity\build\intermediates\tinker_intermediates\tinker_multidexkeep.pro :enterActivity:tinkerProcessDebugMultidexKeep :youkuPlayerOpenSDK:prepareComAndroidSupportSupportV42421Library UP-TO-DATE :youkuPlayerOpenSDK:prepareReleaseDependencies :youkuPlayerOpenSDK:compileReleaseAidl :enterActivity:processDebugJavaRes UP-TO-DATE :enterActivity:validateSigningDebug :youkuPlayerOpenSDK:compileReleaseAidl UP-TO-DATE :youkuPlayerOpenSDK:compileReleaseNdk UP-TO-DATE :youkuPlayerOpenSDK:compileLint UP-TO-DATE :youkuPlayerOpenSDK:copyReleaseLint UP-TO-DATE :youkuPlayerOpenSDK:compileReleaseRenderscript UP-TO-DATE :youkuPlayerOpenSDK:generateReleaseBuildConfig UP-TO-DATE :youkuPlayerOpenSDK:generateReleaseResValues UP-TO-DATE :youkuPlayerOpenSDK:generateReleaseResources UP-TO-DATE :youkuPlayerOpenSDK:mergeReleaseResources UP-TO-DATE :youkuPlayerOpenSDK:processReleaseManifest UP-TO-DATE :youkuPlayerOpenSDK:processReleaseResources :youkuPlayerOpenSDK:generateReleaseSources :youkuPlayerOpenSDK:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE :youkuPlayerOpenSDK:compileReleaseJavaWithJavac UP-TO-DATE :youkuPlayerOpenSDK:extractReleaseAnnotations UP-TO-DATE :youkuPlayerOpenSDK:mergeReleaseShaders UP-TO-DATE :youkuPlayerOpenSDK:compileReleaseShaders UP-TO-DATE :youkuPlayerOpenSDK:generateReleaseAssets UP-TO-DATE :youkuPlayerOpenSDK:mergeReleaseAssets UP-TO-DATE :youkuPlayerOpenSDK:mergeReleaseProguardFiles UP-TO-DATE :youkuPlayerOpenSDK:packageReleaseRenderscript UP-TO-DATE :youkuPlayerOpenSDK:packageReleaseResources UP-TO-DATE :youkuPlayerOpenSDK:processReleaseJavaRes UP-TO-DATE :youkuPlayerOpenSDK:transformResourcesWithMergeJavaResForRelease UP-TO-DATE :youkuPlayerOpenSDK:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE :youkuPlayerOpenSDK:mergeReleaseJniLibFolders UP-TO-DATE :youkuPlayerOpenSDK:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE :youkuPlayerOpenSDK:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE :youkuPlayerOpenSDK:bundleRelease UP-TO-DATE :enterActivity:prepareComAndroidSupportMultidex101Library UP-TO-DATE :enterActivity:prepareComAndroidSupportSupportCompat2421Library UP-TO-DATE :enterActivity:prepareComAndroidSupportSupportCoreUi2421Library UP-TO-DATE :enterActivity:prepareComAndroidSupportSupportCoreUtils2421Library UP-TO-DATE :enterActivity:prepareComAndroidSupportSupportFragment2421Library UP-TO-DATE :enterActivity:prepareComAndroidSupportSupportMediaCompat2421Library UP-TO-DATE :enterActivity:prepareComAndroidSupportSupportV42421Library UP-TO-DATE :enterActivity:prepareComTencentTinkerTinkerAndroidLib174Library UP-TO-DATE :enterActivity:prepareComTencentTinkerTinkerAndroidLoader174Library UP-TO-DATE :enterActivity:prepareMaizuo4XYoukuPlayerOpenSDKUnspecifiedLibrary UP-TO-DATE :enterActivity:prepareDebugDependencies :enterActivity:compileDebugAidl UP-TO-DATE :enterActivity:compileDebugRenderscript UP-TO-DATE :enterActivity:generateDebugResources UP-TO-DATE :enterActivity:mergeDebugResources UP-TO-DATE :enterActivity:processDebugManifest D:\as_workspace\maizuo4.x\enterActivity\src\main\AndroidManifest.xml:878:5-65 Warning: Element uses-permission#android.permission.CAMERA at AndroidManifest.xml:878:5-65 duplicated with element declared at AndroidManifest.xml:864:5-65 D:\as_workspace\maizuo4.x\enterActivity\src\main\AndroidManifest.xml:890:5-66 Warning: Element uses-permission#android.permission.VIBRATE at AndroidManifest.xml:890:5-66 duplicated with element declared at AndroidManifest.xml:883:5-66 tinker add 0d97029 to your AndroidManifest.xml D:\as_workspace\maizuo4.x\enterActivity\build\intermediates\manifests\full\debug\AndroidManifest.xml tinker gen AndroidManifest.xml in build/intermediates/tinker_intermediates/AndroidManifest.xml :enterActivity:tinkerProcessDebugManifest we build enterActivity apk with apply resource mapping file D:\as_workspace\maizuo4.x\enterActivity\build\bakApk/enterActivity-debug-1111-09-45-24-R.txt tinker gen resource public.xml in build/intermediates/tinker_intermediates/public.xml tinker gen resource idx.xml in build/intermediates/tinker_intermediates/idx.xml :enterActivity:tinkerProcessDebugResourceId :enterActivity:processDebugResources :enterActivity:generateDebugSources :enterActivity:compileDebugJavaWithJavac Full recompilation is required because at least one of the classes of removed jar 'gson-2.2.4.jar' requires it. Analysis took 0.548 secs. * 注: Creating file:/D:/as_workspace/maizuo4.x/enterActivity/build/generated/source/apt/debug/com/hyx/maizuo/main/app/MaizuoTinkerApplication.java 注: 某些输入文件使用或覆盖了已过时的 API。 注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。 注: 某些输入文件使用了未经检查或不安全的操作。 注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。 :enterActivity:compileDebugSources :enterActivity:mergeDebugAssets UP-TO-DATE :enterActivity:transformClassesWithAuxiliaryInjectForDebug [AuxiliaryInject] PreGeneratedPatchDex mode is disabled, skip transforming. :enterActivity:transformClassesWithJarMergingForDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':enterActivity:transformClassesWithJarMergingForDebug'.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/gson/Gson$5.class

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1 mins 42.776 secs duplicate entry: com/google/gson/Gson$5.class

以下是依赖的库 ----------------------依赖的库 ------------------------------------

dependencies { compile("com.tencent.tinker:tinker-android-lib:${TINKER_VERSION}") { changing = true } provided("com.tencent.tinker:tinker-android-anno:${TINKER_VERSION}") { changing = true }

//tinker调试代码
compile("com.tencent.tinker:tinker-android-loader:${TINKER_VERSION}") { changing = true }
compile("com.tencent.tinker:aosp-dexutils:${TINKER_VERSION}") { changing = true }
compile("com.tencent.tinker:bsdiff-util:${TINKER_VERSION}") { changing = true }
compile("com.tencent.tinker:tinker-commons:${TINKER_VERSION}") { changing = true }

compile "com.android.support:multidex:1.0.1"
compile project(':youkuPlayerOpenSDK')
compile 'com.google.code.gson:gson:2.2.4'
compile files('libs/alipaysdk.jar')
compile files('libs/alipaysecsdk.jar')
compile files('libs/alipayutdid.jar')
compile files('libs/baidumapapi_base_v4_0_0.jar')
compile files('libs/baidumapapi_map_v4_0_0.jar')
compile files('libs/baidumapapi_search_v4_0_0.jar')
compile files('libs/baidumapapi_util_v4_0_0.jar')
compile files('libs/bugly_1.2.3.8__release.jar')
compile files('libs/core.jar')
compile files('libs/jg_filter_sdk_1.1.jar')
compile files('libs/jpush-android-2.1.5.jar')
compile files('libs/libammsdk.jar')
compile files('libs/locSDK_6.13.jar')
compile files('libs/mid-sdk-2.20.jar')
compile files('libs/mqqopenpay.jar')
compile files('libs/mta-sdk-1.6.2.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/oneapm-android-agent.jar')
compile files('libs/open_sdk_r5043.jar')
compile files('libs/sun.misc.BASE64Decoder.jar')
compile files('libs/tncrash.jar')
compile files('libs/umeng-analytics-v5.2.4.jar')
compile files('libs/universal-image-loader-1.9.2-SNAPSHOT-with-sources.jar')
compile files('libs/weibosdkcore_v3.1.1.jar')
compile files('libs/wup-1.0.0-SNAPSHOT.jar')
compile files('libs/Xg_sdk_v2.39_20150915_1121.jar')
compile files('libs/yinshengpluginmerchant.jar')

}

其中第三方youkuplayeropenSdk依赖库文件如下: dependencies { compile 'com.android.support:support-v4:22.0.0' compile files('libs/baseproject.jar') compile files('libs/fastjson-1.2.7.jar') compile files('libs/mAppTracker.jar') compile files('libs/mvvtracker.jar') compile files('libs/playerBase.jar') compile files('libs/tracking.jar') compile files('libs/YoukuAnalytics.jar') }

SmallBlueWhale avatar Nov 11 '16 02:11 SmallBlueWhale

你好,你把build.gradle里的tinkerEnabled设成false之后还会出现这个问题吗?

tys282000 avatar Nov 11 '16 02:11 tys282000

设置成false之后,项目的tinker分组下的task都没了,无法调试。我是在修改代码后用tinkerpatchdebug这个task打补丁包出现问题的。

SmallBlueWhale avatar Nov 11 '16 02:11 SmallBlueWhale

额,设成false就相当于不引入tinker。在不引入tinker的情况下你试试直接触发assembleDebug,看看有没有问题?

tys282000 avatar Nov 11 '16 02:11 tys282000

额,设成false就相当于不引入tinker。在不引入tinker的情况下你试试直接触发assembleDebug,看看有没有问题?

tys282000 avatar Nov 11 '16 02:11 tys282000

@tomystang 设置false后,程序是正常执行

SmallBlueWhale avatar Nov 11 '16 02:11 SmallBlueWhale

好的,明白了,我看下是不是我那个transform的问题吧。

tys282000 avatar Nov 11 '16 02:11 tys282000

我用 1.7.3 也会出现这个问题,先用 ctrl+d 编译,再用 gradle tinkerPatchDebug 就会出现这个问题,在文件夹 app/build/intermediates/transforms/AuxiliaryInject/debug/jars/1/1f 下可以看到所有的 jar 包都有两份。如果只用命令行,或者只用快捷键不会有问题。

realjustinwu avatar Nov 12 '16 14:11 realjustinwu

使用 1.7.5尝试

shwenzhang avatar Nov 18 '16 08:11 shwenzhang

我用1.7.5也出这个问题 报的是fastjson duplicate entry: com/alibaba/fastjson/annotation/JSONCreator.class

设置false后,程序是正常执行 怎么解决

springtom avatar Mar 04 '17 08:03 springtom