Skip to content

error: cannot find symbol .addInterceptor(OkHttp3Helper.getPinningInterceptor()) #83

@ys-sherzad

Description

@ys-sherzad

Hi there, as the title suggests, it's complaining about not being able to find symbol OkHttp3Helper and I'm not sure what to do!

package af.myapp;
import android.os.Bundle;
import com.facebook.react.ReactActivity;
import com.zoontek.rnbootsplash.RNBootSplash;
import com.datatheorem.android.trustkit.TrustKit;
import com.datatheorem.android.trustkit.reporting.BackgroundReporter;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

import javax.net.ssl.HttpsURLConnection;

import okhttp3.OkHttpClient;

// omitted code

@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Using the default path - res/xml/network_security_config.xml
    TrustKit.initializeWithNetworkSecurityConfiguration(this);

    URL url = new URL("https://172.30.200.168");
    String serverHostname = url.getHost();

    // HttpsUrlConnection
    HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
    connection.setSSLSocketFactory(TrustKit.getInstance().getSSLSocketFactory(serverHostname));
    
    // OkHttp 3.0.x, 3.1.x and 3.2.x
    OkHttpClient client =
      new OkHttpClient.Builder()
          .sslSocketFactory(OkHttp3Helper.getSSLSocketFactory())
          .addInterceptor(OkHttp3Helper.getPinningInterceptor())
          .followRedirects(false)
          .followSslRedirects(false);

    RNBootSplash.init(R.drawable.bootsplash, MainActivity.this); // <- display the generated bootsplash.xml drawable over our MainActivity
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions