Can't import the Arduino I2S.h library: no such file or directory

I want to use the I2S library from Arduino framework, on an ESP32 board, but can’t import it.
A simple example like this doesn’t compile

#include <Arduino.h>
#include "I2S.h"

void setup()
{
    Serial.begin(115200);
    Serial.println("initialization done.");

    I2S.begin(I2S_PHILIPS_MODE, 16000, 16);
    I2S.end();
}

void loop()
{
}

My platformio.ini file:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino

Why can’t PIO find Arduino’s I2S library? How can I make it work?

If it can’t find the file then your Espressif32 platform is either corrupted or out of date. As a quick fix, open a CLI and execute

pio upgrade --dev
pio pkg update -g -p espressif32

And compile the project again. Does it work now?