问题
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