ESP32 I2C Error

First of all, I am using i2c on ESP32 using wire() library. It used to work fine. But now, when I use wire, what I see is C:\Program Files (x86)\Arduino\libraries\Wire\src\utility\twi.c:26:20: fatal error: avr/io.h: No such file or directory wire() works fine for ESP8266 and Arduino. I looked into all the forums and took advantage of Duck Duck Go and Google as well. But I didn't see anything. By the way, I even reinstalled Arduino, and the problem still exists. Greatly appreciate for any helps or tips. Thank you.

You must delete this folder:

C:\Program Files (x86)\Arduino\libraries\Wire

Arduino boards platforms always come with their own bundled version of the Wire library. The Arduino IDE automatically uses the library for the board you are compiling for. Since the API of the libraries are compatible, you probably wouldn't even notice that a different library is being used when you compile for one board or the other, but the low level code inside the library is very different.

When you installed that Wire library to C:\Program Files (x86)\Arduino\libraries\Wire, you broke the Arduino IDE's ability to pick the right library, so you are compiling code that is not compatible with the ESP32 architecture rather than the correct library being used.

Thank you.

You are welcome. I'm glad if I was able to be of assistance.