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.43k stars 809 forks source link

打包异常 #444

Open skyofsky opened 3 years ago

skyofsky commented 3 years ago

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

异常类型:编译异常

手机型号:编译异常

手机系统版本:编译异常

Robust版本:0.4.99

Gradle版本:6.5 dependencies { classpath "com.android.tools.build:gradle:4.1.0"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.meituan.robust:gradle-plugin:0.4.99'
    classpath 'com.meituan.robust:auto-patch-plugin:0.4.99'
}

系统:Windows

堆栈/日志:Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'task ':app:packageR elease' property 'resourceFiles'' with class 'org.gradle.api.internal.file.DefaultFilePropertyFactory$DefaultDir ectoryVar' to class 'java.io.File'

To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/6.5/userguide/gradle_daemon.html. Daemon will be stopped at the end of the build stopping after processing

Configure project :app Register robust transform successful !!!

Task :clean Task :app:clean Task :app:preBuild UP-TO-DATE Task :app:extractProguardFiles Task :app:preReleaseBuild Task :app:compileReleaseAidl NO-SOURCE Task :app:compileReleaseRenderscript NO-SOURCE Task :app:generateReleaseBuildConfig Task :app:javaPreCompileRelease Task :app:checkReleaseAarMetadata Task :app:generateReleaseResValues Task :app:generateReleaseResources Task :app:createReleaseCompatibleScreenManifests Task :app:extractDeepLinksRelease Task :app:processReleaseMainManifest Task :app:mergeReleaseResources Task :app:processReleaseManifest Task :app:processReleaseManifestForPackage Task :app:processReleaseResources

Task :app:compileReleaseJavaWithJavac

Task :app:compileReleaseSources Task :app:mergeReleaseNativeDebugMetadata NO-SOURCE Task :app:mergeReleaseShaders Task :app:lintVitalRelease Task :app:compileReleaseShaders NO-SOURCE Task :app:generateReleaseAssets UP-TO-DATE Task :app:mergeReleaseAssets Task :app:compressReleaseAssets Task :app:mergeReleaseGeneratedProguardFiles UP-TO-DATE Task :app:processReleaseJavaRes NO-SOURCE Task :app:checkReleaseDuplicateClasses Task :app:mergeReleaseJavaResource

Task :app:transformClassesWithRobustForRelease ================robust start================ read all class file cost 0.249 second ===robust print id start=== key is com.meituan.sample.MainActivity.onCreate(android.os.Bundle) value is 1 key is com.meituan.sample.MainActivity.isGrantSDCardReadPermission() value is 2 key is com.meituan.sample.MainActivity.requestPermission() value is 3 key is com.meituan.sample.MainActivity.onRequestPermissionsResult(int,java.lang.String[],int[]) value is 4 key is com.meituan.sample.MainActivity.handlePermissionResult() value is 5 key is com.meituan.sample.MainActivity.runRobust() value is 6 key is com.meituan.sample.MainActivity.access$000(com.meituan.sample.MainActivity) value is 7 key is com.meituan.sample.MainActivity.access$100(com.meituan.sample.MainActivity) value is 8 key is com.meituan.sample.MainActivity.access$200(com.meituan.sample.MainActivity) value is 9 key is com.meituan.sample.MainActivity$1.onClick(android.view.View) value is 10 key is com.meituan.sample.MainActivity$2.onClick(android.view.View) value is 11 key is com.meituan.sample.MainActivity$3.onClick(android.view.View) value is 12 key is com.meituan.sample.PatchManipulateImp.fetchPatchList(android.content.Context) value is 13 key is com.meituan.sample.PatchManipulateImp.verifyPatch(android.content.Context,com.meituan.robust.Patch) value is 14 key is com.meituan.sample.PatchManipulateImp.copy(java.lang.String,java.lang.String) value is 15 key is com.meituan.sample.PermissionUtils.checkSelfPermission(android.content.Context,java.lang.String) value is 16 key is com.meituan.sample.PermissionUtils.isGrantSDCardReadPermission(android.content.Context) value is 17 key is com.meituan.sample.PermissionUtils.requestSDCardReadPermission(android.app.Activity,int) value is 18 key is com.meituan.sample.RobustCallBackSample.onPatchListFetched(boolean,boolean,java.util.List) value is 19 key is com.meituan.sample.RobustCallBackSample.onPatchFetched(boolean,boolean,com.meituan.robust.Patch) value is 20 key is com.meituan.sample.RobustCallBackSample.onPatchApplied(boolean,com.meituan.robust.Patch) value is 21 key is com.meituan.sample.RobustCallBackSample.logNotify(java.lang.String,java.lang.String) value is 22 key is com.meituan.sample.RobustCallBackSample.exceptionNotify(java.lang.Throwable,java.lang.String) value is 23 key is com.meituan.sample.SecondActivity.onCreate(android.os.Bundle) value is 24 key is com.meituan.sample.SecondActivity.getTextInfo() value is 25 key is com.meituan.sample.SecondActivity.onCreateView(java.lang.String,android.content.Context,android.util.AttributeSet) value is 26 key is com.meituan.sample.SecondActivity.onClick(android.view.View) value is 27 key is com.meituan.sample.SecondActivity.getReflectField(java.lang.String,java.lang.Object) value is 28 key is com.meituan.sample.SecondActivity.getFieldValue(java.lang.String,java.lang.Object) value is 29 key is com.meituan.sample.SecondActivity.printLog(java.lang.String,java.lang.String[][]) value is 30 key is com.meituan.sample.SecondActivity.lambda$onCreate$0(android.view.View) value is 31 ===robust print id end=== robust cost 2.705 second ================robust end================

Task :app:minifyReleaseWithR8 Task :app:collectReleaseDependencies Task :app:sdkReleaseDependencyData Task :app:mergeReleaseJniLibFolders Task :app:validateSigningRelease Task :app:mergeReleaseNativeLibs Task :app:stripReleaseDebugSymbols NO-SOURCE Task :app:packageRelease FAILED 30 actionable tasks: 29 executed, 1 up-to-date

如是编译异常,请在执行gradle命令时,加上--stacktrace,并把结果重定向,例如在demo中重定向命令如下:./gradlew clean assembleRelease --stacktrace --no-daemon >log.txt ,结果重定向到当前的目录下的log.txt文件; 日志中我们需要过滤"robust"关键字,可以初步查找问题的大概原因; Robust提供了sample样例与我们的源码,大家在使用前可以先将样例跑通,如遇任何疑问也欢迎大家提出,更鼓励大家给我们提pr,谢谢大家的支持.