java - XMPP Connection with Smack 4.1 on Android Studio -


i trying xmpp connection smack 4.1.0 rc1 https://github.com/igniterealtime/smack followed guide https://github.com/igniterealtime/smack/wiki/smack-4.1-readme-and-upgrade-guide importing gradle.

source code:

package com.example.xmpp_app;  import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.view.menu; import android.view.menuitem;  import org.jivesoftware.smack.abstractxmppconnection; import org.jivesoftware.smack.smackexception; import org.jivesoftware.smack.xmppexception; import org.jivesoftware.smack.tcp.xmpptcpconnection; import org.jivesoftware.smack.tcp.xmpptcpconnectionconfiguration;  import java.io.ioexception;  public class mainactivity extends actionbaractivity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          // create configuration new connection         xmpptcpconnectionconfiguration.builder configbuilder = xmpptcpconnectionconfiguration.builder();         configbuilder.setusernameandpassword("test@example.com", "password123");         configbuilder.setresource("test");         configbuilder.setservicename("example.com");          abstractxmppconnection connection = new xmpptcpconnection(configbuilder.build());         // connect server         try {             connection.connect();         } catch (smackexception e) {             e.printstacktrace();         } catch (ioexception e) {             e.printstacktrace();         } catch (xmppexception e) {             e.printstacktrace();         }         // log server         try {             connection.login();         } catch (xmppexception e) {             e.printstacktrace();         } catch (smackexception e) {             e.printstacktrace();         } catch (ioexception e) {             e.printstacktrace();         }          // disconnect server         connection.disconnect();     }       @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate menu; adds items action bar if present.         getmenuinflater().inflate(r.menu.menu_main, menu);         return true;     }      @override     public boolean onoptionsitemselected(menuitem item) {         // handle action bar item clicks here. action bar         // automatically handle clicks on home/up button, long         // specify parent activity in androidmanifest.xml.         int id = item.getitemid();          //noinspection simplifiableifstatement         if (id == r.id.action_settings) {             return true;         }          return super.onoptionsitemselected(item);     } } 

gradle:

// top-level build file can add configuration options common sub-projects/modules.  buildscript {     repositories {         jcenter()         maven {             url 'https://oss.sonatype.org/content/repositories/snapshots'         }         mavencentral()     }     dependencies {         classpath 'com.android.tools.build:gradle:1.1.0'          // note: not place application dependencies here; belong         // in individual module build.gradle files     } }  allprojects {     repositories {         jcenter()     } } 

build gradle:

apply plugin: 'com.android.application'  android {     compilesdkversion 21     buildtoolsversion "21.1.2"      defaultconfig {         applicationid "com.example.xmpp_app"         minsdkversion 15         targetsdkversion 21         versioncode 1         versionname "1.0"     }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'         }     } }  dependencies {     compile filetree(dir: 'libs', include: ['*.jar'])     compile 'com.android.support:appcompat-v7:21.0.3'     compile "org.igniterealtime.smack:smack-java7:4.1.0-rc1"     // optional xmpptcpconnection     compile "org.igniterealtime.smack:smack-tcp:4.1.0-rc1"     // optional xmpp-im (rfc 6121) support (roster, threaded chats, …)     compile "org.igniterealtime.smack:smack-im:4.1.0-rc1"     // optional xmpp extensions support     compile "org.igniterealtime.smack:smack-extensions:4.1.0-rc1" } 

error:

03-20 20:34:33.830    1005-1005/com.example.xmpp_app i/dalvikvm﹕ not find method android.view.viewgroup.onnestedscrollaccepted, referenced method android.support.v7.internal.widget.actionbaroverlaylayout.onnestedscrollaccepted 03-20 20:34:33.830    1005-1005/com.example.xmpp_app w/dalvikvm﹕ vfy: unable resolve virtual method 11345: landroid/view/viewgroup;.onnestedscrollaccepted (landroid/view/view;landroid/view/view;i)v 03-20 20:34:33.850    1005-1005/com.example.xmpp_app d/dalvikvm﹕ vfy: replacing opcode 0x6f @ 0x0000 03-20 20:34:33.850    1005-1005/com.example.xmpp_app i/dalvikvm﹕ not find method android.view.viewgroup.onstopnestedscroll, referenced method android.support.v7.internal.widget.actionbaroverlaylayout.onstopnestedscroll 03-20 20:34:33.850    1005-1005/com.example.xmpp_app w/dalvikvm﹕ vfy: unable resolve virtual method 11351: landroid/view/viewgroup;.onstopnestedscroll (landroid/view/view;)v 03-20 20:34:33.850    1005-1005/com.example.xmpp_app d/dalvikvm﹕ vfy: replacing opcode 0x6f @ 0x0000 03-20 20:34:33.920    1005-1005/com.example.xmpp_app i/dalvikvm﹕ not find method android.support.v7.internal.widget.actionbaroverlaylayout.stopnestedscroll, referenced method android.support.v7.internal.widget.actionbaroverlaylayout.sethideoncontentscrollenabled 03-20 20:34:33.920    1005-1005/com.example.xmpp_app w/dalvikvm﹕ vfy: unable resolve virtual method 9039: landroid/support/v7/internal/widget/actionbaroverlaylayout;.stopnestedscroll ()v 03-20 20:34:33.950    1005-1005/com.example.xmpp_app d/dalvikvm﹕ vfy: replacing opcode 0x6e @ 0x000e 03-20 20:34:34.100    1005-1005/com.example.xmpp_app i/dalvikvm﹕ not find method android.content.res.typedarray.getchangingconfigurations, referenced method android.support.v7.internal.widget.tinttypedarray.getchangingconfigurations 03-20 20:34:34.110    1005-1005/com.example.xmpp_app w/dalvikvm﹕ vfy: unable resolve virtual method 364: landroid/content/res/typedarray;.getchangingconfigurations ()i 03-20 20:34:34.110    1005-1005/com.example.xmpp_app d/dalvikvm﹕ vfy: replacing opcode 0x6e @ 0x0002 03-20 20:34:34.150    1005-1005/com.example.xmpp_app i/dalvikvm﹕ not find method android.content.res.typedarray.gettype, referenced method android.support.v7.internal.widget.tinttypedarray.gettype 03-20 20:34:34.150    1005-1005/com.example.xmpp_app w/dalvikvm﹕ vfy: unable resolve virtual method 386: landroid/content/res/typedarray;.gettype (i)i 03-20 20:34:34.150    1005-1005/com.example.xmpp_app d/dalvikvm﹕ vfy: replacing opcode 0x6e @ 0x0002 03-20 20:34:35.790    1005-1005/com.example.xmpp_app d/dalvikvm﹕ gc_for_alloc freed 221k, 9% free 3164k/3452k, paused 105ms, total 115ms 03-20 20:34:38.420    1005-1005/com.example.xmpp_app d/dalvikvm﹕ gc_for_alloc freed 295k, 10% free 3382k/3744k, paused 90ms, total 93ms 03-20 20:34:40.250    1005-1005/com.example.xmpp_app d/dalvikvm﹕ gc_for_alloc freed 349k, 11% free 3531k/3952k, paused 80ms, total 85ms 03-20 20:34:40.310    1005-1005/com.example.xmpp_app e/dalvikvm﹕ not find class 'javax.naming.directory.initialdircontext', referenced method org.jivesoftware.smack.util.dns.javax.javaxresolver.<clinit> 03-20 20:34:40.310    1005-1005/com.example.xmpp_app w/dalvikvm﹕ vfy: unable resolve new-instance 1688 (ljavax/naming/directory/initialdircontext;) in lorg/jivesoftware/smack/util/dns/javax/javaxresolver; 03-20 20:34:40.320    1005-1005/com.example.xmpp_app d/dalvikvm﹕ vfy: replacing opcode 0x22 @ 0x000c 03-20 20:34:40.360    1005-1005/com.example.xmpp_app i/dalvikvm﹕ not find method javax.naming.directory.dircontext.getattributes, referenced method org.jivesoftware.smack.util.dns.javax.javaxresolver.lookupsrvrecords 03-20 20:34:40.360    1005-1005/com.example.xmpp_app w/dalvikvm﹕ vfy: unable resolve interface method 12701: ljavax/naming/directory/dircontext;.getattributes (ljava/lang/string;[ljava/lang/string;)ljavax/naming/directory/attributes; 03-20 20:34:40.370    1005-1005/com.example.xmpp_app d/dalvikvm﹕ vfy: replacing opcode 0x72 @ 0x0011 03-20 20:34:40.370    1005-1005/com.example.xmpp_app d/dalvikvm﹕ dexopt: unable opt direct call 0x319e @ 0x0e in lorg/jivesoftware/smack/util/dns/javax/javaxresolver;.<clinit> 03-20 20:34:40.410    1005-1005/com.example.xmpp_app w/dalvikvm﹕ exception ljava/lang/noclassdeffounderror; thrown while initializing lorg/jivesoftware/smack/util/dns/javax/javaxresolver; 03-20 20:34:41.330    1005-1005/com.example.xmpp_app i/dalvikvm﹕ not find method javax.security.sasl.sasl.createsaslclient, referenced method org.jivesoftware.smack.sasl.javax.sasljavaxmechanism.authenticateinternal 03-20 20:34:41.330    1005-1005/com.example.xmpp_app w/dalvikvm﹕ vfy: unable resolve static method 12731: ljavax/security/sasl/sasl;.createsaslclient ([ljava/lang/string;ljava/lang/string;ljava/lang/string;ljava/lang/string;ljava/util/map;ljavax/security/auth/callback/callbackhandler;)ljavax/security/sasl/saslclient; 03-20 20:34:41.340    1005-1005/com.example.xmpp_app d/dalvikvm﹕ vfy: replacing opcode 0x77 @ 0x001a 03-20 20:34:41.340    1005-1005/com.example.xmpp_app w/dalvikvm﹕ vfy: unable resolve exception class 1708 (ljavax/security/sasl/saslexception;) 03-20 20:34:41.350    1005-1005/com.example.xmpp_app w/dalvikvm﹕ vfy: unable find exception handler @ addr 0x21 03-20 20:34:41.350    1005-1005/com.example.xmpp_app w/dalvikvm﹕ vfy:  rejected lorg/jivesoftware/smack/sasl/javax/sasljavaxmechanism;.authenticateinternal ()v 03-20 20:34:41.350    1005-1005/com.example.xmpp_app w/dalvikvm﹕ vfy:  rejecting opcode 0x0d @ 0x0021 03-20 20:34:41.350    1005-1005/com.example.xmpp_app w/dalvikvm﹕ vfy:  rejected lorg/jivesoftware/smack/sasl/javax/sasljavaxmechanism;.authenticateinternal ()v 03-20 20:34:41.350    1005-1005/com.example.xmpp_app w/dalvikvm﹕ verifier rejected class lorg/jivesoftware/smack/sasl/javax/sasljavaxmechanism; 03-20 20:34:41.370    1005-1005/com.example.xmpp_app w/dalvikvm﹕ exception ljava/lang/verifyerror; thrown while initializing lorg/jivesoftware/smack/smackinitialization; 03-20 20:34:41.370    1005-1005/com.example.xmpp_app w/dalvikvm﹕ exception ljava/lang/verifyerror; thrown while initializing lorg/jivesoftware/smack/connectionconfiguration; 03-20 20:34:41.380    1005-1005/com.example.xmpp_app d/androidruntime﹕ shutting down vm 03-20 20:34:41.380    1005-1005/com.example.xmpp_app w/dalvikvm﹕ threadid=1: thread exiting uncaught exception (group=0xb1a3bba8) 03-20 20:34:41.540    1005-1005/com.example.xmpp_app d/dalvikvm﹕ gc_for_alloc freed 438k, 14% free 3576k/4112k, paused 59ms, total 64ms 03-20 20:34:41.580    1005-1005/com.example.xmpp_app e/androidruntime﹕ fatal exception: main     process: com.example.xmpp_app, pid: 1005     java.lang.verifyerror: org/jivesoftware/smack/sasl/javax/sasljavaxmechanism             @ org.jivesoftware.smack.sasl.javax.sasljavaxsmackinitializer.initialize(sasljavaxsmackinitializer.java:28)             @ org.jivesoftware.smack.smackinitialization.loadsmackclass(smackinitialization.java:232)             @ org.jivesoftware.smack.smackinitialization.parseclassestoload(smackinitialization.java:193)             @ org.jivesoftware.smack.smackinitialization.processconfigfile(smackinitialization.java:163)             @ org.jivesoftware.smack.smackinitialization.processconfigfile(smackinitialization.java:148)             @ org.jivesoftware.smack.smackinitialization.<clinit>(smackinitialization.java:116)             @ org.jivesoftware.smack.smackconfiguration.getversion(smackconfiguration.java:96)             @ org.jivesoftware.smack.connectionconfiguration.<clinit>(connectionconfiguration.java:38)             @ com.example.xmpp_app.mainactivity.oncreate(mainactivity.java:29)             @ android.app.activity.performcreate(activity.java:5231)             @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1087)             @ android.app.activitythread.performlaunchactivity(activitythread.java:2159)             @ android.app.activitythread.handlelaunchactivity(activitythread.java:2245)             @ android.app.activitythread.access$800(activitythread.java:135)             @ android.app.activitythread$h.handlemessage(activitythread.java:1196)             @ android.os.handler.dispatchmessage(handler.java:102)             @ android.os.looper.loop(looper.java:136)             @ android.app.activitythread.main(activitythread.java:5017)             @ java.lang.reflect.method.invokenative(native method)             @ java.lang.reflect.method.invoke(method.java:515)             @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779)             @ com.android.internal.os.zygoteinit.main(zygoteinit.java:595)             @ dalvik.system.nativestart.main(native method) 03-20 20:39:44.485    1005-1005/com.example.xmpp_app i/process﹕ sending signal. pid: 1005 sig: 9 

anyone me out problem please? trying check if connection works..

replace smack-java7 smack-android in build.gradle. documented in smack's readme.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -