Hmm, sounds more like a strategy problem, you can normally build 2 farmers before first enemy joins the battlefield, then you put an archer in the line of it, build next farmer, next enemy comes, archer, archer, farmer, archer , after that when you got first row with archers filled, you can set next row archers leave one row empty and then get the shield guys step by step and fill the empty row with more archers, wizards or dwarves. You can also set shield guys earlier as they have much cooldown when you got at least 2 archers in that line.
So a good setup is Row: 1. Archers 2. farmers, 3. archers 4. archers or wizards or dwarves (leave this row empty first and focus on row 5.) 5. shield guys (i would skip the dwarves for now, too expensive, archers and farmers should get some upgrades from, merchant first, they are most important)