However, when I try to use libraries & compile the project I get the following error message:
Sketch uses 1355462 bytes (103%) of program storage space. Maximum is 1310720 bytes.
Global variables use 58980 bytes (17%) of dynamic memory, leaving 268700 bytes for local variables. Maximum is 327680 bytes.
Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
Error compiling for board ESP32 Dev Module.
It is clear that the libraries are too big for the ESP32. So I was wondering if there is a way to reduce the size of one of these libraries? If so, how?
teije:
It is clear that the libraries are too big for the ESP32.
No it isn't.
The real problem is that your code is too big for the ESP32. The libraries are simply convenient ways to code which is why everybody uses them. Material in the library that is superfluous to your needs is ignored during compilation. You could dispense with the libraries altogether and do the whole job yourself but code is code so you needn't expect any worthwhile decrease in the storage space required.
As a case in point, I never use an RTC library, I just use a routine that I got to work first and have never had a need to change. I have checked it against RTC.lib, and found I save only about a dozen bytes.
I have never heard of anybody running out of memory on an ESP32 before. I would not have thought those libraries were particularly demanding. It is just possible that they are incredibly badly written, but I think you have simply chosen the wrong MCU for the job - whatever that is.