Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在gradle7.0上面感觉运行速度还是很慢 #17

Closed
lhjgege opened this issue Dec 16, 2021 · 16 comments
Closed

在gradle7.0上面感觉运行速度还是很慢 #17

lhjgege opened this issue Dec 16, 2021 · 16 comments

Comments

@lhjgege
Copy link

lhjgege commented Dec 16, 2021

我升级了我的项目到gralde7.0.3版本后每次运行起码的3分钟以上。在4.1.3版本的时候就很快,不知道是不是没有适配7.0的原因

@trycatchx
Copy link
Owner

1、检查 根目录/.gradle/.rockectx/.app/ 文件夹缓存是否生成。
2、并查看 执行的task 是否只有 app module 和 改动的module (其他module 的task 理论是不允许执行)
3、以上两点都正常请贴一下:耗时图
image
4、第一次是全量无增速效果,请查看2 次以上修改code 的编译速度

@lhjgege
Copy link
Author

lhjgege commented Dec 16, 2021

我换一个手机点击安装的就会很慢

@lhjgege
Copy link
Author

lhjgege commented Dec 16, 2021

换一个手机点击安装感觉像是重新全量编译。

@trycatchx
Copy link
Owner

trycatchx commented Dec 16, 2021

@lhj1079947827 换个手机 你可以用 assembledebug task 试试。 (直接点击 run ,as 对这方面有一定的处理)

@trycatchx
Copy link
Owner

你可以测试一下点击 run 在同一个手机的速度 是否有提升呢?

@lhjgege
Copy link
Author

lhjgege commented Dec 16, 2021

同一个手机有提升的。

@lhjgege
Copy link
Author

lhjgege commented Dec 16, 2021

但是不同手机点击安装没有提升每次都是全量编译的感觉。因为我这里有多个手机所以会安装很多手机。如果每个手机都是全量编译那么感觉速度还是没提升的感觉。同一个手机我刚才测试了提升很大从3分钟提升到25S

@trycatchx
Copy link
Owner

image
可以通过尝试使用 assembledebug task 运行(这个和换手机关系就不大了,应该可以满足你的需要)

@lhjgege
Copy link
Author

lhjgege commented Dec 16, 2021


image

我这里没这个选项

@lhjgege
Copy link
Author

lhjgege commented Dec 16, 2021


image

就修改两个类感觉时间忽快忽慢

@lhjgege
Copy link
Author

lhjgege commented Dec 16, 2021


image

上面图就是compileDebugKotlin和transformClassesWithASMPPluginForDebug两个插件耗时

@trycatchx
Copy link
Owner

trycatchx commented Dec 16, 2021

@lhj1079947827 transformClassesWithASMPPluginForDebug 这个插件关闭是否会有影响:可以通过:

//app moudle 下的 build.gradle
android {
    //...
    //配置插件编译项
    RocketX {
        openLog = true
        //加速模式 禁用可禁用的 transform ,速度更快
        transFormList = ["ASMPPlugin"]
    }
}

插件的名字你需要确认一下是不是 :ASMPPluginForDebug,通过在build log 查找关键字: transFormList ,会有提示。

@trycatchx
Copy link
Owner

@lhj1079947827 禁用之后 buildDex,以及 mergeDex 会更快。应该可以跑进10s内

@lhjgege
Copy link
Author

lhjgege commented Dec 16, 2021

你是禁用那个插件,是上面两个插件吗

@trycatchx
Copy link
Owner

trycatchx commented Dec 16, 2021

禁用ASMPPlugin

@trycatchx
Copy link
Owner

@lhj1079947827 请问有效果吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants