I think there is no way to avoid the offside trap.

Just see the situation with logic: He will play offside trap if you will play with counterattacks. So if he will do that, disable the counter attacks and don't play a "Very Attacking" tactic.