Meituan-Dianping / Robust

Robust is an Android HotFix solution with high compatibility and high stability. Robust can fix bugs immediately without a reboot.
Apache License 2.0
4.42k stars 807 forks source link

Error:Execution failed for task ':app:transformClassesWithRobustForQianfanRelease'. > cannot find com.zxinsight.r: com.zxinsight.R found in com/zxinsight/r.class #202

Open duxxz opened 6 years ago

duxxz commented 6 years ago

在提交issue之前,我们应该先查询是否已经有相关的issue和ReadMe中的注意事项,比如说Robust在0.3.3版本才支持windows开发。提交issue时,我们需要写明issue的原因,最好可以携带编译或运行过程的日志或者截图。issue最好以下面的格式提出:

异常类型:Error:Execution failed for task ':app:transformClassesWithRobustForQianfanRelease'.

cannot find com.zxinsight.r: com.zxinsight.R found in com/zxinsight/r.class

手机型号:编译异常

手机系统版本:编译异常

Robust版本:0.4.7

Gradle版本:3.3 系统:window 10

堆栈/日志: Error:Execution failed for task ':app:transformClassesWithRobustForQianfanRelease'.

cannot find com.zxinsight.r: com.zxinsight.R found in com/zxinsight/r.class 之前的 0.3.3 版本是assembleDebug走不通, 升级0.4.7 之后. assembleRealease都走不通了.看似是 魔窗sdk . aar zxinsight 的混淆问题.

hedex commented 6 years ago

com.zxinsight.R 这个class不存在;

hedex commented 6 years ago

命令行里面加上--stacktrace,把报错的log发给我把,感谢

duxxz commented 6 years ago

To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/3.3/userguide/gradle_daemon.html. Daemon will be stopped at the end of the build stopping after processing Parallel execution is an incubating feature. Using the 'clean' task in combination with parallel execution may lead to unexpected runtime behavior. qfindex:初始化... Register robust transform successful !!! Observed package id 'add-ons;addon-open_mobile_api-giesecke_devrient_gmbh-24' in inconsistent location 'H:\Develope\sdk-lastest\add-ons\addon-open_mobile_api-giesecke_devrient_gmbh-19' (Expected 'H:\Develope\sdk-lastest\add-ons\addon-open_mobile_api-giesecke_devrient_gmbh-24') Observed package id 'add-ons;addon-open_mobile_api-giesecke_devrient_gmbh-24' in inconsistent location 'H:\Develope\sdk-lastest\add-ons\addon-open_mobile_api-giesecke_devrient_gmbh-19' (Expected 'H:\Develope\sdk-lastest\add-ons\addon-open_mobile_api-giesecke_devrient_gmbh-24') :app:clean :lib-preference:clean :lib-base:clean :lib-preference-processor:clean UP-TO-DATE :lib-preference-processor:processResources UP-TO-DATE :lib-preference:compileJava :lib-preference:processResources UP-TO-DATE :lib-preference:classes :lib-preference:jar :lib-preference-processor:compileJava :lib-preference-processor:classes :lib-preference-processor:jar :app:preBuild UP-TO-DATE :app:extractProguardFiles :app:preQianfanReleaseBuild :app:checkQianfanReleaseManifest :app:preQianfanDebugBuild UP-TO-DATE :app:prepareBreakpadReleaseLibrary :app:prepareComAndroidSupportAnimatedVectorDrawable2531Library :app:prepareComAndroidSupportAppcompatV72531Library :app:prepareComAndroidSupportConstraintConstraintLayout102Library :app:prepareComAndroidSupportDesign2531Library :app:preQianfanDebugAndroidTestBuild UP-TO-DATE :app:prepareComAndroidSupportMultidex101Library :app:prepareComAndroidSupportPercent2531Library :app:prepareComAndroidSupportRecyclerviewV72531Library :app:prepareComAndroidSupportSupportCompat2531Library :app:prepareComAndroidSupportSupportCoreUi2531Library :app:prepareComAndroidSupportSupportCoreUtils2531Library :app:prepareComAndroidSupportSupportFragment2531Library :app:prepareComAndroidSupportSupportMediaCompat2531Library :app:prepareComAndroidSupportSupportV42531Library :app:prepareComAndroidSupportSupportVectorDrawable2531Library :app:prepareComAndroidSupportTransition2531Library :app:prepareComDlazaro66QrcodereaderviewQrcodereaderview202Library :app:prepareComFacebookFrescoAnimatedBase150Library :app:prepareComFacebookFrescoAnimatedDrawable150Library :app:prepareComFacebookFrescoAnimatedWebp150Library :app:prepareComFacebookFrescoDrawee150Library :app:prepareComFacebookFrescoFbcore150Library :app:prepareComFacebookFrescoFresco150Library :app:prepareComFacebookFrescoImagepipeline150Library :app:prepareComFacebookFrescoImagepipelineBase150Library :app:prepareComFacebookFrescoImagepipelineOkhttp3150Library :app:prepareComFacebookFrescoWebpsupport150Library :app:prepareComGithubChrisbanesPhotoView126Library :app:prepareComGithubCymChadBaseRecyclerViewAdapterHelper2918Library :app:prepareComGithubHackware1993MagicIndicator150Library :app:prepareComGithubMarkzhaiBlockcanaryNoOp150Library :app:prepareComKsyunMediaLibksyliveArmv7a240Library :app:prepareComKsyunMediaLibksyliveJava240Library :app:prepareComMeituanRobustRobust047Library :app:prepareComMostafagazarCustomshapeimageview104Library :app:prepareComShizhefeiLargeImageView109Library :app:prepareComSohuQianfanActionHookLibrary105Library :app:prepareComSohuQianfanBaseFaac100Library :app:prepareComSohuQianfanBaseFaceunitySdk342DevLibrary :app:prepareComSohuQianfanBaseGallerypick102Library :app:prepareComSohuQianfanBaseLibjpeg100Library :app:prepareComSohuQianfanBaseQfhttp144Library :app:prepareComSohuQianfanBaseQfnative111Library :app:prepareComSohuQianfanBaseQfpermission108Library :app:prepareComSohuQianfanBaseQfsocket104Library :app:prepareComSohuQianfanModuleLoginLogin540Library :app:prepareComSquareupLeakcanaryLeakcanaryAndroidNoOp151Library :app:prepareComTheartofdevEdmodoAndroidImageCropper231Library :app:prepareComYalantisUcrop220Library :app:prepareComYouthBannerBanner149Library :app:prepareDeHdodenhofCircleimageview130Library :app:prepareGpuimageReleaseLibrary :app:prepareIjkplayerArmv7aReleaseLibrary :app:prepareIjkplayerJavaReleaseLibrary :app:prepareIoReactivexRxjava2Rxandroid201Library :app:prepareJava_websocketReleaseLibrary :app:prepareJpWasabeefGlideTransformations202Library :app:prepareJsonrpc2ReleaseLibrary :app:prepareLib_grain_permissionReleaseLibrary :app:prepareLibjingle_peerconnectionReleaseLibrary :app:prepareMagicWindowSDKLibrary :app:prepareOrgAdwLibraryDiscreteSeekbar101Library :app:prepareQfForFu101Library :app:prepareQfgameReleaseLibrary :app:prepareQfsdk_gameReleaseLibrary :app:prepareQianliyanlib130Library :app:prepareRloud_jsonrpc_wsReleaseLibrary :app:prepareRloud_sdkReleaseLibrary :app:prepareRloud_utilReleaseLibrary :app:prepareRloud_webrtcpeerReleaseLibrary :app:prepareSeEmilsjolanderStickylistheaders270Library :app:prepareSohuMediaPlayerReleaseLibrary :app:generateQianfanReleaseBuildConfig :app:generateQianfanReleaseResValues :app:incrementalQianfanReleaseJavaCompilationSafeguard :app:javaPreCompileQianfanRelease :app:compileQianfanReleaseNdk UP-TO-DATE :app:mergeQianfanReleaseShaders :app:compileQianfanReleaseShaders :app:generateQianfanReleaseAssets :app:processQianfanReleaseJavaRes UP-TO-DATE :lib-base:preBuild UP-TO-DATE :lib-base:preDebugBuild UP-TO-DATE :lib-base:checkDebugManifest :lib-base:preDebugAndroidTestBuild UP-TO-DATE :lib-base:preDebugUnitTestBuild UP-TO-DATE :lib-base:preReleaseBuild UP-TO-DATE :lib-base:preReleaseUnitTestBuild UP-TO-DATE :lib-base:prepareComAndroidSupportAnimatedVectorDrawable2531Library :lib-base:prepareComAndroidSupportAppcompatV72531Library :lib-base:prepareComAndroidSupportConstraintConstraintLayout102Library :lib-base:prepareComAndroidSupportDesign2531Library :lib-base:prepareComAndroidSupportMultidex101Library :lib-base:prepareComAndroidSupportPercent2531Library :lib-base:prepareComAndroidSupportRecyclerviewV72531Library :lib-base:prepareComAndroidSupportSupportCompat2531Library :lib-base:prepareComAndroidSupportSupportCoreUi2531Library :lib-base:prepareComAndroidSupportSupportCoreUtils2531Library :lib-base:prepareComAndroidSupportSupportFragment2531Library :lib-base:prepareComAndroidSupportSupportMediaCompat2531Library :lib-base:prepareComAndroidSupportSupportV42531Library :lib-base:prepareComAndroidSupportSupportVectorDrawable2531Library :lib-base:prepareComAndroidSupportTransition2531Library :lib-base:prepareComDlazaro66QrcodereaderviewQrcodereaderview202Library :lib-base:prepareComFacebookFrescoAnimatedBase150Library :lib-base:prepareComFacebookFrescoAnimatedDrawable150Library :lib-base:prepareComFacebookFrescoAnimatedWebp150Library :lib-base:prepareComFacebookFrescoDrawee150Library :lib-base:prepareComFacebookFrescoFbcore150Library :lib-base:prepareComFacebookFrescoFresco150Library :lib-base:prepareComFacebookFrescoImagepipeline150Library :lib-base:prepareComFacebookFrescoImagepipelineBase150Library :lib-base:prepareComFacebookFrescoImagepipelineOkhttp3150Library :lib-base:prepareComFacebookFrescoWebpsupport150Library :lib-base:prepareComKsyunMediaLibksyliveJava240Library :lib-base:prepareComSohuQianfanBaseFaac100Library :lib-base:prepareComSohuQianfanBaseGallerypick102Library :lib-base:prepareComSohuQianfanBaseLibjpeg100Library :lib-base:prepareComSohuQianfanBaseQfhttp144Library :lib-base:prepareComSohuQianfanBaseQfnative111Library :lib-base:prepareComSohuQianfanBaseQfpermission108Library :lib-base:prepareComSohuQianfanBaseQfsocket104Library :lib-base:prepareComYalantisUcrop220Library :lib-base:prepareIoReactivexRxjava2Rxandroid201Library :lib-base:prepareDebugDependencies :lib-base:compileDebugAidl :lib-base:compileDebugNdk UP-TO-DATE :lib-base:compileLint :lib-base:copyDebugLint UP-TO-DATE :lib-base:compileDebugRenderscript :lib-base:generateDebugBuildConfig :lib-base:generateDebugResValues :lib-base:generateDebugResources :lib-base:mergeDebugResources :lib-base:processDebugManifest :lib-base:processDebugResources :lib-base:generateDebugSources :lib-base:incrementalDebugJavaCompilationSafeguard :lib-base:javaPreCompileDebug :lib-base:compileDebugJavaWithJavac QFPreferenceProcessor CostTime : 268 QFPreferenceProcessor CostTime : 1 QFPreferenceProcessor CostTime : 0 :lib-base:extractDebugAnnotations :lib-base:mergeDebugShaders :lib-base:compileDebugShaders :lib-base:generateDebugAssets :lib-base:mergeDebugAssets :lib-base:mergeDebugProguardFiles :lib-base:packageDebugRenderscript UP-TO-DATE :lib-base:packageDebugResources :lib-base:processDebugJavaRes UP-TO-DATE :lib-base:transformResourcesWithMergeJavaResForDebug :lib-base:transformClassesAndResourcesWithSyncLibJarsForDebug :lib-base:mergeDebugJniLibFolders :lib-base:transformNativeLibsWithMergeJniLibsForDebug :lib-base:transformNativeLibsWithStripDebugSymbolForDebug :lib-base:transformNativeLibsWithSyncJniLibsForDebug :lib-base:bundleDebug :app:prepareQianfanReleaseDependencies :lib-base:checkReleaseManifest :app:compileQianfanReleaseAidl :lib-base:prepareReleaseDependencies :lib-base:compileReleaseAidl :lib-base:compileReleaseNdk UP-TO-DATE :lib-base:copyReleaseLint UP-TO-DATE :lib-base:compileReleaseRenderscript :app:compileQianfanReleaseRenderscript :lib-base:generateReleaseBuildConfig :app:generateQianfanReleaseResources :app:mergeQianfanReleaseResources :lib-base:generateReleaseResValues :lib-base:generateReleaseResources :lib-base:mergeReleaseResources :lib-base:processReleaseManifest :lib-base:processReleaseResources :lib-base:generateReleaseSources :lib-base:incrementalReleaseJavaCompilationSafeguard :lib-base:javaPreCompileRelease :lib-base:compileReleaseJavaWithJavac QFPreferenceProcessor CostTime : 350 QFPreferenceProcessor CostTime : 0 QFPreferenceProcessor CostTime : 0 :lib-base:extractReleaseAnnotations :lib-base:mergeReleaseShaders :lib-base:compileReleaseShaders :lib-base:generateReleaseAssets :lib-base:mergeReleaseAssets :lib-base:mergeReleaseProguardFiles :lib-base:packageReleaseRenderscript UP-TO-DATE :lib-base:packageReleaseResources :lib-base:processReleaseJavaRes UP-TO-DATE :lib-base:transformResourcesWithMergeJavaResForRelease :lib-base:transformClassesAndResourcesWithSyncLibJarsForRelease :app:processQianfanReleaseManifest :lib-base:mergeReleaseJniLibFolders :lib-base:transformNativeLibsWithMergeJniLibsForRelease :lib-base:transformNativeLibsWithStripDebugSymbolForRelease E:\sohu_qianfan\qianfan\qianfan\app\src\main\AndroidManifest.xml:58:9-61:36 Warning: meta-data#com.sohu.qianfan.view.webapp.QianFanWebViewModule was tagged at AndroidManifest.xml:58 to replace another declaration but no other declaration present :app:processQianfanReleaseResources :lib-base:transformNativeLibsWithSyncJniLibsForRelease :lib-base:bundleRelease :lib-base:compileReleaseSources :lib-base:assembleRelease :app:generateQianfanReleaseSources :app:compileQianfanReleaseJavaWithJavac :app:compileQianfanReleaseSources :app:lintVitalQianfanRelease :app:mergeQianfanReleaseAssets :app:transformClassesWithActionHookTransformForQianfanRelease 转换所有的类完成,耗时 22.511 秒 插入代码完成,耗时 25.2 秒 :app:transformClassesWithCheckJavaMappingTransformForQianfanRelease :app:transformClassesWithRobustForQianfanRelease ================robust start================ read all class file cost 4.16 second :app:transformClassesWithRobustForQianfanRelease FAILED

BUILD FAILED

Total time: 9 mins 16.425 secs

================Console output================

FAILURE: Build failed with an exception.

zhaolp2005 commented 6 years ago

我也遇到了类似的错误, Caused by: java.lang.RuntimeException: cannot find com.zxinsight.r: com.zxinsight.R found in com/zxinsight/r.class at javassist.CtClassType.getClassFile2(CtClassType.java:202) at javassist.CtClassType.getModifiers(CtClassType.java:407) at robust.gradle.plugin.asm.AsmInsertImpl.insertCode(AsmInsertImpl.java:50) at robust.gradle.plugin.RobustTransform.transform(RobustTransform.groovy:163) 1)观察错误堆栈信息定位到代码 robust.gradle.plugin.asm.AsmInsertImpl.insertCode(AsmInsertImpl.java:50) 2)如下代码是执行流程(robust.gradle.plugin.RobustTransform) def box = ConvertUtils.toCtClasses(inputs, classPool) def cost = (System.currentTimeMillis() - startTime) / 1000 // logger.quiet "check all class cost $cost second, class count: ${box.size()}" if(useASM){ insertcodeStrategy=new AsmInsertImpl(hotfixPackageList,hotfixMethodList,exceptPackageList,exceptMethodList,isHotfixMethodLevel,isExceptMethodLevel); }else { insertcodeStrategy=new JavaAssistInsertImpl(hotfixPackageList,hotfixMethodList,exceptPackageList,exceptMethodList,isHotfixMethodLevel,isExceptMethodLevel); } insertcodeStrategy.insertCode(box, jarFile); 3) 可能因为混淆规则,com.zxinsight.R 这个class不存在,导致执行过程会报错 4) 我尝试了一种解决方式,过滤下box容器,过滤掉报错的jar文件 def box = ConvertUtils.toCtClasses(inputs, classPool) 5) 过滤代码如下 if(className.indexOf("com.zxinsight") == -1){ classNames.add(className) } 过滤掉zxinsight,避免其出现在容器中,编译后可以正常使用 希望能给出正式的解决方案

smuwjs commented 3 years ago

遇到同样的问题,已想到处理办法,看看可行不。#465