In case anyone had this problem I found the solution. It was simply a proxy problem and missing library problem.
add the rxJava ,okio and Okhttp jar lib.
This step is optional if u have a proxy problem like i did.
String hostname = "10.84.10.11"; int port = 3128; Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(hostname, port)); OkHttpClient client = new OkHttpClient.Builder().proxy(proxy).build(); String url = "https://rinkeby.infura.io/v3/c270b7df7bf54378a96ef7fe28e54715"; web3 = Web3j.build(new HttpService(url, client, true));