Thanks for your reply!
I was trying to use the rapidapi for http request which needed the following dependencies:
Don't forget to also install the dependencies (org.json, httpclient 4.3.6, httpmime 4.3.6, httpasyncclient 4.0.2) in the classpath too.
So I added the jar files to libs and added as library.
I then decided to try HTTP POST using JSON in Java and that is when I ran into the problem.
I added the dependencies to the build.gradle: