Adding buildFeatures { compose true } causes build to take indefinitely. How to investigate issue?

五迷三道 提交于 2021-01-29 06:17:49

问题


After having a good experience with Jetpack Compose in new projects I decided to add Compose to an existing project of my company. After making all the necessary changes and writing the first lines of compose code I tried to build the project for the first time. Unfortunately, the build process gets stuck during ui:compileDebugKotlin multiple times (I waited for almost 45m and then stopped the build).

I never got any error message, all I could conclude is, that the problem arises after adding buildFeatures { compose true } to my modules build.gradle. Without this line the build finishes within 3 seconds (-> It's not a performance issue)

I currently have no clue where to start cause I got no error. I cannot reproduce the issue in a plain project. How can I find the cause of this issue?


回答1:


As it turns out there are problems when using kotlin-android-extensions(which has been deprecated recently) and compose alongside each other in the same module (as of compose-alpha09).

I had to migrate to viewBinding (which is very time time consuming) and remove apply plugin: android-kotlin-extensions

Being forced to migrate to viewBiding makes composes backwards compatibility pretty useless since it may take a lot of time to migrate. Also, an error message would have saved a ton of time.



来源:https://stackoverflow.com/questions/65452642/adding-buildfeatures-compose-true-causes-build-to-take-indefinitely-how-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!