MissingComponentException: There is no 'Animation' to the "aaa" gameobject

I get this error message when I try to play an animation clip using Legacy system.
===> aaa.GetComponent().Play(“walk”);

MissingComponentException: There is no ‘Animation’ to the “aaa” gameObject…

But the “aaa” gameObject has Animation component. All animation clips in “aaa” are marked as Legacy.

Anyone can help me to fix this?

I am using Unity 5.3.4 free version. Thanks for reading.

Never mind. I fixed it, but I don’t understand how it is fixed.