Unknown attribute warning in XML

Viewed 3680

AndroidManifest and XML layouts are showing me the Unknown attribute android: warning even though the attributes exist and the app works on the device.

Example: Unknown attribute android:maxSdkVersion, android:clickable="true" etc.

I am aware of the other questions regarding this issue and tried everything I could find about this topic but nothing works for me. I tried to:

Sync Project with Gradle Files

Delete the .idea and .gradle folders from the project location

Delete caches from c:\Users\<user>\.gradle\caches\

Invalidate caches and restart ...and many other things I couldn't remember right now.

The problem still persists on a newly installed OS (Windows 11) and obviously, newly installed Android Studio, and also the issue affects only old projects...

Also, my project is up to date with everything the Android Studio doesn't show me any warning to update a version of a dependency or so.

Gradle version 7.3.3 Android Gradle Plugin Version 7.2.1

Update:

The warning appears only with the SDK version 33 (compileSdkVersion 33), if I build with version 32, the warning disappears...

Update2:

New projects which use API level 33 still show the warning... Maybe it's a bug in the SDK?

3 Answers

Got same crap and a lot of other. And yes, just downgraded buildToolsVersion to "32.1.0 rc1" and targetSdkVersion, compileSdkVersion to API 32 for as long as bug exists in API 33.

Same here, I use this temporary workaround until Android team fix this issue or better solution.

  • Move all require code for Android 13 into library module (in my case, all of them are moved into utility module) and keep it use compile SDK 33
  • Temporary changes compile SDK in other module to 32 for local development

It's not ideal, but switching to Dolphin RC1 resolves this. Given that it will (presumably) hit stable pretty soon, it may not get fixed in Chipmunk. You can download Dolphin from the Android Studio Preview page, just be aware that it is not available as an installer so you will need to manually update your installed version or use it alongside until it hits stable.

Related