The community forums are in BETA and closed to the public.

I got Follwing error, when i execute my app please help me

Caused by: java.lang.ClassNotFoundException: Didn't find class "org.slf4j.LoggerFactory" on path: DexPathList[[zip file "/data/app/com.example.pounkumarp.helpino-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

code: public class MainActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    com();
}

private void com() {
   final Pubnub pubnub = new Pubnub("pub-c-290e11d0-0e56-4377-9946-0941730a1f83","sub-c-35546042-2e19-11e5-83fd-0619f8945a4f");

    try {
        pubnub.subscribe("my_channel", new Callback() {
                    @Override
                    public void connectCallback(String channel, Object message) {
                        pubnub.publish("my_channel", "Hello from the PubNub Java SDK", new Callback() {});
                    }

                    @Override
                    public void disconnectCallback(String channel, Object message) {

                        System.out.println("SUBSCRIBE : DISCONNECT on channel:" + channel
                                + " : " + message.getClass() + " : "
                                + message.toString());
                    }

                    public void reconnectCallback(String channel, Object message) {
                        System.out.println("SUBSCRIBE : RECONNECT on channel:" + channel
                                + " : " + message.getClass() + " : "
                                + message.toString());
                    }

                    @Override
                    public void successCallback(String channel, Object message) {
                        System.out.println("SUBSCRIBE : " + channel + " : "
                                + message.getClass() + " : " + message.toString());
                    }

                    @Override
                    public void errorCallback(String channel, PubnubError error) {
                        System.out.println("SUBSCRIBE : ERROR on channel " + channel
                                + " : " + error.toString());
                    }
                }
        );
    } catch (PubnubException e) {
        Toast.makeText(this,e.getMessage(),Toast.LENGTH_SHORT).show();
    }
   // send(pubnub);
}

private void send(Pubnub pubnub) {

}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }

    return super.onOptionsItemSelected(item);
}

}

Pounkumar,

How are you using the PubNub Android SDK? Did you manually add the .jar file to your classpath or are you using Maven/Gradle?

gradle


Comments to this discussion are now closed!