How can I take out the barbarians in Clash Royale?

The clash royale arena website has a pretty good list of cards detailing what their strengths and weaknesses are. You can check out what they have to say about barbarians.

In my experience, most air units that attack ground units work well against the barbarians (i.e. minions and minion horde, etc... ), as well as units that deal area damage (valkyrie, wizard, and the bomber). Cards that spawn many units can work as well (like skeleton army, or witch) Note that the level of your cards compared to your opponents could make a big difference.

If you are having issues with the barbarians as a defense unit (that is, they keep killing your giant or whatever you are attacking) trying backing it up with one of the above units. If you are having problems defending against them, any of the above ones should be fine.