The process of creation is accepted as:
Akash → Vayu → Agni → Water → Earth
This is said by Sri Shankaracharya in the BU (Brihadaranyak Upanishad) 1.2.1 commentary:
As he was worshipping, water, an all-liquid substance forming an accessory of the worship, was produced. Here we must supply the words, 'After the manifestation of the ether, air and fìre,’ for another Śruti (Tai. II. i. i) says so, and there can be no alternative in the order of manifestation
On the other hand, BU 1.2.2 says:
Water is Arka. What was there (like) froth on the water was solidified and became this earth. When that was produced, he was tired. While he was (thus) tired and distressed, his essence, or lustre, came forth. This was Fire.
Agni was created before water, so which Agni came after Prajapati was tired?
My other doubt is why Sri Shankaracharya said the cause of fire is water and that fire rests on water, when the fact is that water came after fire.
What is this Arka? Water, that accessory of worship, is Arka, being the cause of fire. For, it is said, fire rests on water.
-- Sri Shankaracharya commentary on BU 1.2.2