Recently I've been unable to install or upgrade libraries in the Arduino IDE. I've upgraded to 1.8.9, have uninstalled Arduino, moved the ~/Documents/Arduino and ~/Library/Arduino15 folders (so as not to lose them) and re-installed Arduino, all to no avail.
When I select a library from the IDE's Library Manager, choose the latest version from the drop-down and click Install, I see (for example) the "Downloading library: Adafruit NeoPixel" message at the bottom of the window, but nothing happens after that: no progress bar filling, no errors - just stuck at that message until I quit the IDE.
I disabled my Avira antivirus, rebooted my laptop (MacBook Pro with Mojave 10.14.4) to no avail. The IDE's Board Manager seems to be working, as I was able to install support for a new Adafruit board.
Further investigation reveals that the IDE is trying to download the appropriate archive to ~/Library/Arduino15/staging/libraries but that file is zero bytes in size. I am able to retrieve the zip file via the url property's value from ~/Library/Arduino15/library_index.json (both using a browser and using curl) and successfully install it using Sketch > Include Library > Add .ZIP Library, so it seems the IDE is failing to successfully download the library archives. I'm using the latest Java JRE from Oracle.
Does the issue occur when you try to install any library via Library Manager, or only with the Adafruit NeoPixel library?
It might be that the first download of the file failed somehow, then after that the Arduino IDE sees that file in the ~/Library/Arduino15/staging/libraries folder and things "hey, I already downloaded the file, no reason wasting bandwidth downloading it again", without realizing that the file is bad, which will cause the next step of the installation process to fail. If that is the case, then deleting the zero bye file would fix the issue (though ideally the Arduino IDE would be smart enough to do that automatically).
The issue happens for all libraries (at least all the ones I've tried so far). I did delete all the zero-length files in the staging folder as well, and the issue still exists.
I'm going to try it on my work laptop to see if I can reproduce the issue.
That is strange. I did an installation of the Adafruit NeoPixel library via Library Manager to verify that things are working fine on my end.
Is there enough free space on the hard drive? I know you said you successfully installed it via Sketch > Include Library > Add .ZIP Library, but that installs to a different location, which might be on a different drive.
There is enough free drive space (~18GB). I also did directly download several library ZIP files directly from the URLs in library_index.json, and added those libraries using Add ZIP Library... - that worked, so it's something with the IDE's Library Manager not being able to download the full archives. It's interesting that the Library Manager creates the ZIP file in the 'staging' area (though with zero bytes) but can't download the contents of the file.
Ah, I missed the part where you said you got the URL from library_index.json. Good work!
I assumed you just grabbed the library from Adafruit's GitHub repository.
I just tested the same Manage Library operations on my work laptop - same macOS version (macOS Mojave 10.14.4) and same Arduino IDE version (1.8.9) - and I'm seeing the same problems as on my home laptop.
They were on the same network when I ran my tests. I just tried connecting my home laptop to the internet using WiFi tethering to the cellular network and I was able to install libraries. That's odd, because I can retrieve the same library ZIP files from the same locations using a browser or curl, so the Arduino IDE must be doing something differently.
I'll look at my router configuration and see if it's blocking anything. I took a quick look at that during my tests and didn't find anything, so I'll dig deeper this time.
Further investigation has revealed the cause: my Synology Router's Threat Prevention feature is flagging "A network trojan was detected" and more specifically "ET INFO JAVA - Java Archive Download By Vulnerable Client" when attempting to download Arduino library archives using the Arduino IDE's Library Manager, and the router is dropping the archive file's packets. When I add a rule to "alert" instead of "drop" those packets, I'm able to download and install libraries using Arduino IDE's Library Manager.
your answer greatly helped me with the same problem which bothering me for a long time, I had tried every setting of antivirus or firewall in windows, but I totally forgot the problem may be in the router.
thank you very much.