'import java.net.http.HttpRequest, import java.net.http.HttpResponse, and import java.net.http.HttpClient not working

I'm making an app in Android Studio using Java and I want to access an API url, so I need HttpRequest, HttpResponse, and HttpClient. However, none of them are importing. Here's a picture of what the import statements look like right now. I have Android Studio 2020.3.1 and Java 11.0.10. Am I doing something wrong?

Edit: I think it's because Android uses HttpsURLConnection instead of all those other ones.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source