Cannot resolve method ‘loadTrustMaterial’

I am using Android studio (in Linux) to make a project and in which I had to write code by which I can accept all the certificates. But the problem I am facing while using TrustSelfSignedStrategy is that when I pass this through builder.loadTrustMaterial, it shows something like Cannot resolve method ‘loadTrustMaterial'(null,org.apache.http.conn.TrustSelfSignedStrategy).
A screenshot has been attached. However, the same code is working in Eclipse with the same library.

loadTrustMaterial Error