Monday, April 8, 2024

cvc-complex-type.2.4.a: Invalid content was found starting with element 'base-extension'. One of '{layoutlib}' is expected Error in Android


We were facing this issue many times when we download project from github. We are using new Android studio. 

Error was: cvc-complex-type.2.4.a: Invalid content was found starting with element 'base-extension'. One of '{layoutlib}' is expected. 

This is not the gradle issue. When we search this over internet, we get lot of answers as it's a gradle issue. But following all those solutions are in vain as this is not actually a gradle issue.

We solved this issue with some experiments. 

Android SDK configuration file ~/Library/Android/sdk/platforms/android-32/package.xml has an extra tag named base-extension compared to the same file of other API levels. Removing this tag solves the problem.
Delete downloaded Android API 32 SDK Platform from SDK Manager (Tools → SDK Manager) also solves the problem (you can redownload after deletion). Maybe the Android studio team noticed the problem, redownloading API 32 platform files, the base-extension tag disappeared from the API 32 package.xml








No comments: