Transform

2017-10-31  本文已影响36人  SMSM

被虐死算了,从Multidex开始搞起,先阅读了dex加载的源码,然后开搞dex拆包,拆包涉及到基于Gradle的Android项目构建流程,主要集中在transformXXForNNRelease流程,如何自定义Plugin修改通过Javassist修改字节码的教程,这个教程被我整整实践了两天!晕死!坑越陷越深!两天才把自己救出来

这几篇教程都是坑 https://juejin.im/entry/577b03438ac2470061afb130http://blog.csdn.net/l2show/article/details/54846682
推荐这两篇 热补丁修复技术Javassist简单应用小结

推荐Groovy教程

AndroidGradlePlugin 构建源码在哪里

AndroidGradlePlugin源码
比较重要的类 AppPlugin 、AppExtension、TaskManager、TransformManager、AndroidTask。

如何查看Task依赖树

apply plugin: "com.dorongold.task-tree"

    |    +--- :app:assembleRelease
    |    |    \--- :app:assemblePitayaRelease
    |    |         +--- :app:compilePitayaReleaseSources
    |    |         |    +--- :app:compilePitayaReleaseJavaWithJavac
    |    |         |    |    +--- :app:generatePitayaReleaseSources
    |    |         |    |    |    +--- :app:compilePitayaReleaseAidl
    |    |         |    |    |    |    \--- :app:preparePitayaReleaseDependencies
    |    |         |    |    |    |         +--- :app:checkPitayaReleaseManifest
    |    |         |    |    |    |         |    \--- :app:prePitayaReleaseBuild *
    |    |         |    |    |    |         +--- :app:prePitayaReleaseBuild *
    |    |         |    |    |    |         +--- :app:prepareComAndroidSupportAnimatedVectorDrawable2511Library *
    |    |         |    |    |    |         +--- :app:prepareComAndroidSupportAppcompatV72511Library *
    |    |         |    |    |    |         +--- :app:prepareComAndroidSupportConstraintConstraintLayout100Alpha4Library *
    |    |         |    |    |    |         +--- :app:prepareComAndroidSupportMultidex101Library *
    |    |         |    |    |    |         +--- :app:prepareComAndroidSupportRecyclerviewV72511Library *
    |    |         |    |    |    |         +--- :app:prepareComAndroidSupportSupportCompat2602Library *
    |    |         |    |    |    |         +--- :app:prepareComAndroidSupportSupportCoreUi2602Library *
    |    |         |    |    |    |         +--- :app:prepareComAndroidSupportSupportCoreUtils2602Library *
    |    |         |    |    |    |         +--- :app:prepareComAndroidSupportSupportFragment2602Library *
    |    |         |    |    |    |         +--- :app:prepareComAndroidSupportSupportMediaCompat2602Library *
    |    |         |    |    |    |         +--- :app:prepareComAndroidSupportSupportV42602Library *
    |    |         |    |    |    |         +--- :app:prepareComAndroidSupportSupportVectorDrawable2511Library *
    |    |         |    |    |    |         +--- :app:prepareComAntfortuneFreelineRuntimeNoOp087Library
    |    |         |    |    |    |         |    +--- :app:prePitayaDebugUnitTestBuild
    |    |         |    |    |    |         |    |    \--- :app:preBuild *
    |    |         |    |    |    |         |    +--- :app:prePitayaPreReleaseUnitTestBuild
    |    |         |    |    |    |         |    |    +--- :app:extractProguardFiles *
    |    |         |    |    |    |         |    |    \--- :app:preBuild *
    |    |         |    |    |    |         |    +--- :app:prePitayaReleaseBuild *
    |    |         |    |    |    |         |    +--- :app:prePitayaReleaseUnitTestBuild
    |    |         |    |    |    |         |    |    +--- :app:extractProguardFiles *
    |    |         |    |    |    |         |    |    \--- :app:preBuild *
    |    |         |    |    |    |         |    \--- :app:prePitayaStageUnitTestBuild
    |    |         |    |    |    |         |         +--- :app:extractProguardFiles *
    |    |         |    |    |    |         |         \--- :app:preBuild *
    |    |         |    |    |    |         +--- :app:prepareComJakewhartonButterknife850Library *
    |    |         |    |    |    |         +--- :app:prepareComTencentBuglyCrashreport_upgrade131Library *
    |    |         |    |    |    |         +--- :app:prepareIoReactivexRxjava2Rxandroid201Library *
    |    |         |    |    |    |         +--- :app:prepareNetZeteticAndroidDatabaseSqlcipher357Library *
    |    |         |    |    |    |         +--- :app:prepareOrgXwalkXwalk_core_library23535894Library *
    |    |         |    |    |    |         \--- :recycleviewlibrary:bundleRelease *
    |    |         |    |    |    +--- :app:compilePitayaReleaseRenderscript
    |    |         |    |    |    |    +--- :app:checkPitayaReleaseManifest *
    |    |         |    |    |    |    \--- :app:preparePitayaReleaseDependencies *
    |    |         |    |    |    +--- :app:generatePitayaReleaseBuildConfig
    |    |         |    |    |    |    \--- :app:checkPitayaReleaseManifest *
    |    |         |    |    |    \--- :app:processPitayaReleaseResources
    |    |         |    |    |         +--- :app:mergePitayaReleaseResources
    |    |         |    |    |         |    +--- :app:generatePitayaReleaseResources
    |    |         |    |    |         |    |    +--- :app:compilePitayaReleaseRenderscript *
    |    |         |    |    |         |    |    \--- :app:generatePitayaReleaseResValues
    |    |         |    |    |         |    \--- :app:preparePitayaReleaseDependencies *
    |    |         |    |    |         \--- :app:processPitayaReleaseManifest
    |    |         |    |    |              \--- :app:preparePitayaReleaseDependencies *
    |    |         |    |    +--- :app:greendao *
    |    |         |    |    +--- :app:incrementalPitayaReleaseJavaCompilationSafeguard
    |    |         |    |    +--- :app:javaPreCompilePitayaRelease
    |    |         |    |    +--- :app:preparePitayaReleaseDependencies *
    |    |         |    |    \--- :recycleviewlibrary:bundleRelease *
    |    |         |    \--- :app:compilePitayaReleaseNdk
    |    |         |         \--- :app:prePitayaReleaseBuild *
    |    |         +--- :app:lintVitalPitayaRelease
    |    |         |    \--- :app:compilePitayaReleaseJavaWithJavac *
    |    |         +--- :app:packagePitayaRelease
    |    |         |    +--- :app:compilePitayaReleaseJavaWithJavac *
    |    |         |    +--- :app:mergePitayaReleaseAssets
    |    |         |    |    +--- :app:generatePitayaReleaseAssets
    |    |         |    |    |    \--- :app:compilePitayaReleaseShaders
    |    |         |    |    |         \--- :app:mergePitayaReleaseShaders
    |    |         |    |    \--- :app:preparePitayaReleaseDependencies *
    |    |         |    +--- :app:processPitayaReleaseResources *
    |    |         |    +--- :app:transformClassesAndResourcesWithProguardForPitayaRelease
    |    |         |    |    +--- :app:transformClassesWithMyTransformForPitayaRelease
    |    |         |    |    |    +--- :app:compilePitayaReleaseJavaWithJavac *
    |    |         |    |    |    +--- :app:preparePitayaReleaseDependencies *
    |    |         |    |    |    \--- :recycleviewlibrary:bundleRelease *
    |    |         |    |    \--- :app:transformResourcesWithMergeJavaResForPitayaRelease
    |    |         |    |         +--- :app:preparePitayaReleaseDependencies *
    |    |         |    |         +--- :app:processPitayaReleaseJavaRes
    |    |         |    |         \--- :recycleviewlibrary:bundleRelease *
    |    |         |    +--- :app:transformClassesWithDexForPitayaRelease
    |    |         |    |    +--- :app:transformClassesAndResourcesWithProguardForPitayaRelease *
    |    |         |    |    \--- :app:transformClassesWithMultidexlistForPitayaRelease
    |    |         |    |         \--- :app:transformClassesAndResourcesWithProguardForPitayaRelease *
    |    |         |    +--- :app:transformNativeLibsWithMergeJniLibsForPitayaRelease
    |    |         |    |    +--- :app:compilePitayaReleaseNdk *
    |    |         |    |    +--- :app:mergePitayaReleaseJniLibFolders
    |    |         |    |    |    +--- :app:generatePitayaReleaseAssets *
    |    |         |    |    |    \--- :app:preparePitayaReleaseDependencies *
    |    |         |    |    +--- :app:preparePitayaReleaseDependencies *
    |    |         |    |    \--- :recycleviewlibrary:bundleRelease *
    |    |         |    \--- :app:validateSigningPitayaRelease
    |    |         \--- :app:uploadPitayaReleaseSymtabFile
    |    |              \--- :app:packagePitayaRelease *

存在循环依赖

* What went wrong:  
Circular dependency between the following tasks:
:app:transformClassesAndResourcesWithProguardForPitayaRelease
\--- :app:transformClassesWithMyTransformForPitayaRelease
     \--- :app:transformClassesWithMultidexlistForPitayaRelease
          \--- :app:transformClassesAndResourcesWithProguardForPitayaRelease (*)

(*) - details omitted (listed previously)

认识

上一篇下一篇

猜你喜欢

热点阅读