I have solved the problem with the following steps.
(1) connect the phone and then go to device manager to uninstall the Nexus 5 device. Then disconnect your Nexus 5 phone.
(2) Go to Settings> Apps> All> Media Storage, then clear data and clear cache.
(3) Download the newest sdk from Google...