No - because in English that would mean sitting on top and that isn't what the sentence means in 98% of the cases. Using "a fán" is how Hungarian says "in the tree". By allowing "on the tree" you will lose the point of the sentence.
Sometimes duolingo seems to want us to translate the words literally, and other times it seems to want us to translate to the equivalent expression in the other language, which might be literally the same. The inconsistency is very frustrating.
But in Hungarian that would mean inside the tree - possible if there was a hole or something. But normal Hungarian for birds perching on branches on the tree is "on" ie "ezen" - while in English it is "in".