9

I have this xml file. If I compile it works fine, but if I go to see the preview it shows me this error:

enter image description here

I tried to look for this id but I couldn't find it anywhere. What is this @id/visible? How can I fix that? Thanks

Johnson
  • 297
  • 2
  • 5
  • 18
  • 3
    Possible duplicate of ["Couldn't resolve resource" in Android Studio's Preview](http://stackoverflow.com/questions/19429948/couldnt-resolve-resource-in-android-studios-preview) – Charuක Dec 20 '16 at 23:58
  • @Charuka, no, it's a bug of appcompat-v7:25.1.0 as written in accepted answer and http://stackoverflow.com/questions/41303347/couldnt-resolve-resource-id-visible-when-using-textinputlayout. – CoolMind Jan 11 '17 at 09:43
  • Possible duplicate of [Couldn't resolve resource @id/visible when using TextInputLayout](http://stackoverflow.com/questions/41303347/couldnt-resolve-resource-id-visible-when-using-textinputlayout) – Vadim Kotov Jan 15 '17 at 00:39

6 Answers6

10

The error likely originated from android.support.design.widget.TextInputLayout. If so, it (most likely) is a bug, and it has been filed in the Issue Tracker.

To test if android.support.design.widget.TextInputLayout is the culprit, remove them from your layout and see if the error still persists.

If so, you may try to switch the API version in the editor to 19 or below, though you may see some minor differences in the design output. Or simply remove android.support.design.widget.TextInputLayout until the issue has been solved.

6

This is not the solution but I have added these lines to dimens.xml:

<resources>
    <item name="visible" type="id"/>
    <item name="masked" type="id"/>
</resources>
Samin
  • 577
  • 6
  • 6
2

The real reason for this is because you have a LinearLayout inside of a ConstraintLayout. Try to change all LinearLayouts to Constrained ones and the problem will go away

3vts
  • 778
  • 1
  • 12
  • 25
1

try invalidating cache

File → Invalidate caches / Restart... → Just Restart.

Matthew Shearer
  • 2,715
  • 3
  • 23
  • 32
0

You should set 1. android:id="@+id/visible" to android.support.design.widget.TextInputLayout and 2. android:id="@+id/masked" to child of TextInputLayout

0

just add two line cod in strings.xml file Then clean project `

  <item name="visible" type="id"/>
  <item name="masked" type="id"/>`

Because Android studio can not understand the type of attribute of some libraries like 'TextInputLayout ' And by doing this, we'll tell Android Studio that attribute visible is id type

younes
  • 742
  • 7
  • 8