I guess that question would be best answered by a developer but I'll give it a try.
Depends a bit on what kind of animation we're talking about, but the most efficient way should always be animated with code. However, some animations are just too complex to make with code and in that case you can have a sequence of PNGs or a GIF if that is supported.
Recently the design team from Airbnb came up with something that can help in this last scenario, it's called Lottie and it's basically a plugin for After Effects that allows you to export you complex animation as code, which can be then integrated in the app.
I hope this helps and thanks for reading! :)