Home > Software engineering >  How to find id of attribute with error message
How to find id of attribute with error message

Time:09-17

The project I work with has a lot of customization and a lot of components with attributes from different internal libraries. I have to create a custom dialog and set a specific theme on it. I can't pinpoint which attributes are missing from the components used inside and fail to launch my dialog.

I've got this error :

Failed to resolve attribute at index 5: TypedValue{t=0x2/d=0x7f0401c8 a=7}

Is it possible to find the exact attribute name from this error ? What does t, d and a means ?

CodePudding user response:

The error message probably comes from here. Documentation for TypedValue is here.

The type (t) is an attribute. The associated data (d) is 0x7f0401c8 which is the attribute id. This is still a good place to understand the structure of the id. "a" is the asset cookie associated with the attribute which, I think, indicates the the resolved value will be a string.

You may be able to get the name of the resource with a call to Resources#getResourceName(). If that fails, you can work back through the stack trace to where the attribute is being looked up to glean what is being sought. You could also set a break point at the line mentioned in the error message you posted and search back through the call stack. I assume that you have access to the source code which will aid you in the search.

  • Related