xmpp - Integrating Smack with Android Studio project for chat application -


i trying implement chat messenger using ejabberd server , smack library having hard time integrate jars , dependencies of smack. using android studio.

my build.gradle(module):

apply plugin: 'com.android.application'      android {         compilesdkversion 22         buildtoolsversion "22.0.1"          defaultconfig {             applicationid "com.example.nit.xmppclient"             minsdkversion 18             targetsdkversion 22             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:22.2.0'          compile "org.igniterealtime.smack:smack-android:4.1.0"         compile "org.igniterealtime.smack:smack-tcp:4.1.0"         compile "org.igniterealtime.smack:smack-android-extensions:4.1.0"          compile 'org.ogce:xpp3:1.1.6'      } 

firstly getting xmlpullparser error added xpp3. after added xpp3 getting

error:gradle: execution failed task ':app:predexdebug'. > com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished non-zero exit value 1 

build.gradle(project):

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

questions:

how remove error or can cause of error. might missing dependency ?

using smock increase app-size. can acheive im without using library , writing server side code instead. using ejabberd library node-js , android app talking nodejs instead of ejabberd?

and yes more thing :

public class xmppclient {     private static int port = 5222;     private static string host = "my-ip";     private static string service = "my.com";       static xmpptcpconnectionconfiguration conf = xmpptcpconnectionconfiguration.builder()             .setservicename(service)             .setport(port)             .sethost(host)             .setcompressionenabled(false).build();     static xmpptcpconnection connection = new xmpptcpconnection(conf);       public static void register(string username, string password) throws smackexception.notconnectedexception, xmppexception.xmpperrorexception, smackexception.noresponseexception {          accountmanager accountmanager = accountmanager.getinstance(connection);         accountmanager.createaccount(username,password);     }      public static  void main (string args[]) throws smackexception.notconnectedexception, xmppexception.xmpperrorexception, smackexception.noresponseexception {          register("user", "password");      }   } 

i getting error when running xmppclient class

it seems need add multidex support. add multidex support in app's build.gradle file

 android {   compilesdkversion 21  buildtoolsversion "21.1.0"  defaultconfig {     ...     minsdkversion 14     targetsdkversion 21     ...      // enabling multidex support.     multidexenabled true } ... }  dependencies { compile 'com.android.support:multidex:1.0.0' } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -