PeerConnection instance in android is always null?
<p>I have to implement WebRTC in android application, for that I am using <code>libjingle</code> library, ver-11139. In this I always get <code>pc(PeerConnection class instance)</code> is always null. I have checked the values of</p>

<pre><code>factory(PeerConnectionFactory)
iceServers(LinkedList&lt;IceServers&gt;
mediaConstraints
Peer.this(PCObserver interface)) 
</code></pre>

<p>but all of them are not null. Then why I am always getting the result null. Am I doing something wrong here???</p>

<pre><code>pc = factory.createPeerConnection(iceServers, mediaConstraints, Peer.this);
</code></pre>

<p>Edit:</p>

<pre><code> public CallManager(TagoveApplication context, CustomSocket server, CallType callType) {
    this.server = server;
    this.context = context;
    initializeFactoryFieldTrials(); //initialize peer conn factory field trials
    PeerConnectionFactory.initializeAndroidGlobals(context, true, true, true);

    //PeerConnectionFactory.initializeAndroidGlobals(context, true, true, true, VideoRendererGui.getEGLContext());
    factory = new PeerConnectionFactory();

    iceServers.add(new PeerConnection.IceServer("turn:xxx.xxx.xxx.xxx:xxxx?transport=udp", "xxxxxxxx", "xxxxxxxxx"));

    iceServers.add(new PeerConnection.IceServer("stun:stunserver.org"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.ekiga.net"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.fwdnet.net"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.ideasip.com"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.iptel.org"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.rixtelecom.se"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.schlund.de"));

    pcConstraints.mandatory.add(new MediaConstraints.KeyValuePair("OfferToReceiveAudio", "true"));
    pcConstraints.mandatory.add(new MediaConstraints.KeyValuePair("OfferToReceiveVideo", "true"));
    pcConstraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));

    this.callType = callType;
}
</code></pre>

<p>Creating Peer constructor:</p>

<pre><code>    public Peer(
        String label,
        PeerConnectionFactory factory,
        LinkedList&lt;PeerConnection.IceServer&gt; iceServers,
        MediaConstraints mediaConstraints,
        PeerCallbacks peerCallbacks,
        StreamChangeListener listener,
        boolean incoming){

    this.label=label;
    this.peerCBacks=peerCallbacks;

    //Create Peer connection using RTCConfiguration
    Log.d("PCTest","Peer factory value - "+String.valueOf(factory));
    Log.d("PCTest","ice servers size - "+iceServers.size());
    Log.d("PCTest","media constraints - "+String.valueOf(mediaConstraints));

    PeerConnection.RTCConfiguration rtcConfig = new PeerConnection.RTCConfiguration(iceServers);
    rtcConfig.bundlePolicy = PeerConnection.BundlePolicy.MAXBUNDLE;
    rtcConfig.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.REQUIRE;
    rtcConfig.keyType = PeerConnection.KeyType.ECDSA;
    Log.d("","");
    this.pc = factory.createPeerConnection(rtcConfig, mediaConstraints, this);
    Log.d("PCTest","Peer constructor called pc value - "+String.valueOf(this.pc));

    this.streamListener=listener;
    log("new +"+" "+label+ "  "+(peerCallbacks!=null? "notNull":"issNull")+" ++ "+incoming);
}
</code></pre>