I've had good luck using 3M Black weatherstrip adhesive for a couple of things, but not for soles of shoes.

I tend to agree with the others, with something that flexes that much, you'll probably be best served having them resoled...