When I first bought an Android device I was frustrated because the WiFi would work fine for a few days then stop and after a while it would work again.
After a lot of research, here is my conclusion. It may not be right but works for me :
The Android device holds on to the DHCP IP address even after the router has released it and re-assigned it to another device. When the Android tries to reconnect the router will not let the Android keep the IP address so the link is never set up correctly.
1/ When you have a successful connection get the IP and MAC addresses of the Android then set up the router so that that IP address is reserved for that particular device.
2/ On the Android assign a fixed IP address that is within the same subnet but not the DHCP range as your router. E.g.
Subnet mask : 255.255.255.0
Subnet address space : 192.168.1.1 to 192.168.1.254
DHCP range (range set in router) : 192.168.1.1 to 192.168.1.150
Fixed IP address range (addresses set on the devices) : 192.168.1.150 to 192.168.1.254