skip to Main Content

There’s a warning that annoys me in Android Studio 3.5.3 for Linux, which I’m trying for the first time.
I’m following the Android Tutorial Create an interactive Dice Roller app and, on the 3rd step, it says that the button’s text could be altered by changing the attribute "text" on the menu "Declared Attributes" in the layout editor.

Problem is: I don’t have such attribute in the list.

Partial solution: I can change it in the activity xml. There’s an attribute named android:text. Changing this attribute changes also the text in the design window, and there’s no warning on building either.

Anyway on the xml file this warning is issued:

Unknown attribute android:text

Inspection info: This inspection highlights unknown XML attributes in Android resource
files and AndroidManifest.xml

I can’t find any solution for getting rid of it. I tried, without any luck, to emptying/invalidate caches (even if it’s a new project), deleting everything inside AndroidStudio3.5/system/caches and gradle/caches, resyncing gradle, deleting .idea folder and eventually reinstalling Android Studio.

This applies also to other elements that have the same attribute like TextView, EditText or CheckBox. The attribute android:ems is also affected by this warning. It either case, it doesn’t seem to cause problems on the designer or the builder, so I think I can just ignore the warning, but anyway I’d like to know why it’s issued.

Unknown attribute android:text highlighted on activity_main.xml

enter image description here

edit: my Sdk Build-Tools version is 33 (it’s the one that comes with the standard installation, I didn’t change it)

2

Answers


  1. If you’re compileSdkVersion is 33,try downgrading it to 32 in build.gradle(:app)

    Login or Signup to reply.
  2. The same goes here, as long as it’s compiling we’re fine 😉

    As already stated, due to: compileSdkVersion 33

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search