How many hits did you get with: "have any problem by doing it?"
I'd imagine very few.
I've found none with the quote you've mentioned. Is it the problem, then? Can’t I use ''by doing it'' in this particular sentence? Some of the entries I've found on CAE have similar contexts. I wonder why "Will I have any problem by doing it?" is weird if "There's nothing to be gained by doing it." is fine.