Quantcast
Channel: Ignite Realtime : Unanswered Discussions - Support
Viewing all articles
Browse latest Browse all 4979

smack in android problem:NoClassDefFoundError: Failed resolution

$
0
0

I create the test project Smack4_1 (IDE:Eclipse)

step 1:new android project

step 2:import smack4.1.0 libs

libs.png

 

step 3: when I used the code,throw Exception

 

 

import java.io.IOException;

 

 

import org.jivesoftware.smack.SmackException;

import org.jivesoftware.smack.XMPPException;

import org.jivesoftware.smack.tcp.XMPPTCPConnection;

import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;

import org.jivesoftware.smack.ConnectionConfiguration;

 

 

import android.app.Activity;

import android.os.Bundle;

import android.view.Menu;

import android.view.MenuItem;

import android.view.View;

 

 

public class MainActivity extends Activity {

  @Override

  protected void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_main);

  }

  public void onClick(View v){

  new Thread(new Runnable() {

  @Override

  public void run() {

  try {

                 XMPPTCPConnection connection = getConnection();

                 connection.connect();

                 connection.login("anytime_eeeeee","qq123456","ubuntu");

             } catch (SmackException e) {

                 e.printStackTrace();

             } catch (IOException e) {

                 e.printStackTrace();

             } catch (XMPPException e) {

                 e.printStackTrace();

             } catch (Exception e) {

                 e.printStackTrace();

             }

  }

  }).start();

  }

  private XMPPTCPConnection getConnection(){

         XMPPTCPConnectionConfiguration.Builder builder = XMPPTCPConnectionConfiguration.builder();//Exception throws in here

//        builder.setServiceName("ubuntu");

         builder.setHost("58.64.162.184");

         builder.setPort(5222);

         builder.setCompressionEnabled(false);

         builder.setDebuggerEnabled(false);

         builder.setSendPresence(true);

         builder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);

         XMPPTCPConnection connection = new XMPPTCPConnection(builder.build());

         return connection;

     }

}

 

when I click the button,throws Exception:

smackerror1.png

 

What's mean? thanks every one !


Viewing all articles
Browse latest Browse all 4979

Trending Articles