Home Cannot resolve method 'loadTrustMaterial'
Reply: 1

Cannot resolve method 'loadTrustMaterial'

Prashant Dey
1#
Prashant Dey Published in 2017-11-14 22:44:51Z

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.

IntelliJ Amiya
2#
IntelliJ Amiya Reply to 2017-11-15 04:03:09Z

loadTrustMaterial

 public SSLContextBuilder loadTrustMaterial(KeyStore truststore,
                                  TrustStrategy trustStrategy)
                                    throws NoSuchAlgorithmException,
                                           KeyStoreException

You should use TrustStrategy instead of TrustSelfSignedStrategy.

TrustStrategy trust_stgOBJ = new TrustStrategy()

FYI

Moved from org.apache.http.conn.ssl.SSLContexts to org.apache.http.ssl.SSLContexts.

Read sslcontextbuilder and SSLContexts deprecated.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.29875 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO