Library conflicts between ESP32 and standard Arduino libraries

How does one deal with the following sort of library conflicts?

I want the IDE to use all the ESP32 versions of the libraries.

So is there anyway to force Arduino IDE to use the correct version from the correct location of any given library?

Multiple libraries were found for "WiFi.h"
 Used: C:\Users\greg\Documents\Arduino\libraries\WiFi
 Not used: C:\Users\greg\Documents\Arduino\hardware\expressif\esp32\libraries\WiFiESP32
 Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
Multiple libraries were found for "SPI.h"
 Used: C:\Users\greg\Documents\Arduino\hardware\expressif\esp32\libraries\SPI
 Not used: C:\Users\greg\Documents\Arduino\libraries\SPI

One might hope it would prefer the files in the actual board folder being used! Seems to be someone found a solution here: WiFi.h collides with the internal Arduino WiFi.h · Issue #20 · espressif/arduino-esp32 · GitHub

Follow the hints and there seems to be some instructions in the code.

Why did you rename the library folder to WiFiESP32?

Name it back to WiFi and it should work correctly. The Arduino IDE gives include priority to header files that match the library folder name.

Regarding WiFi.h collides with the internal Arduino WiFi.h · Issue #20 · espressif/arduino-esp32 · GitHub, see my comment on that issue to understand that the cause of the problem was different there (not following the installation instructions correctly). In boylesg's case the architecture folder is correctly named so that's not the problem, it's the library folder name.

pert:
Why did you rename the library folder to WiFiESP32?

Name it back to WiFi and it should work correctly. The Arduino IDE gives include priority to header files that match the library folder name.

Regarding WiFi.h collides with the internal Arduino WiFi.h · Issue #20 · espressif/arduino-esp32 · GitHub, see my comment on that issue to understand that the cause of the problem was different there (not following the installation instructions correctly). In boylesg's case the architecture folder is correctly named so that's not the problem, it's the library folder name.

That would be because the Arduino IDE has another issue with duplicate library names when it comes to example sketches.

Renaming the ESP32 version of Wifi library was the only way I could get the Arduino IDE to show the example sketches for the ESP32 version of Wifi.

Look the only way I can solve both issues is to force the arduino ide to use the library version I want it to use.

Is there anyway to do this?

Tried renaming the WifiESP32 library folder back to just Wifi, but left the library name as WifiESP32 in library.properties.

That seems to work - the ide uses the correct version of Wifi library and the Wifi examples appear under 'Examples for ESP32 Dev Modile'

This is want I wanted.

But sadly my ESP32 can't connect to the wifi network with the SimpleWifiServer example - the sketch hangs at WiFi.begin(ssid, password); in setup()

Glad you got it working! I already had the following typed out so I'm posting it anyway:

I can't reproduce the examples issue using Arduino IDE 1.8.3. Which version of the Arduino IDE are you using?

It's easy enough to open examples using File > Open or just double clicking the .ino file if it's associated with the Arduino IDE. If C:\Users\greg\Documents\Arduino\hardware\expressif\esp32\libraries\WiFi\examples is not a convenient location you could save them somewhere else.

As for focing the IDE to use the right version, you could do this:

#include <C:\Users\greg\Documents\Arduino\hardware\expressif\esp32\libraries\WiFiESP32\src\WiFi.h>

The problem is it makes your sketch non-portable.

Do you have the ESP32 stuff installed in your IDE?

My version of Arduino is 1.8.2. Looks like I need to update.

Yes, I installed specifically to look into this issue. I don't own an ESP32 and I've been waiting for the first release of the Arduino core to really start looking into it rather than trying to work with beta software. I'm really surprised they haven't managed a release yet. I'd think that Espressif would make it a priority.

What I notice in Arduino IDE 1.8.2 or 1.8.3 is that when you have a library installed in the sketchbook with the same name as a library bundled with the hardware package, the one in the hardware package shows up in the "Examples for ESP32 Dev Module" section of the File > Examples menu and the one from the sketchbook shows up in the "Examples from Custom Libraries" section. This is not the behavior you described but it could be considered a bug because if you open one of those examples and compile it the library included with the hardware package is used rather than the library that the example is a part of and that example may not be compatible with the other library.

Well I will upgrade to 1.8.3 and see if my ESP32 Wifi example problem disappears.

1.8.3 only has minor changes from 1.8.2. 1.8.2 had a serious bug in the Linux installation script that prompted the release of a minor bugfix version, 1.8.3. People using other operating systems probably won't see a huge difference with 1.8.3 but you also shouldn't encounter any new bugs and it's certainly a good idea to try the latest version when you're encountering undesirable behavior to see if it was already fixed.

The problem seems to have disappeared with version 1.8.3