There's been a LOT of attempts to explain this throughout history, none of them are really airtight. Until one day I finally cracked it. Like seriously, I think I have a solution without a contradiction:
What if... God is just not very clever? He's doing his best, ok?
If he's really all powerful - I hear you object - couldn't he simply increase his intelligence? Yes. Yes he could. If he thought of it =(