powered by Jive Software

How to import smack in Android Studio

I have imported smack as a project in Android Studio, and builded serveral jars.

I copy some of those jars to libs in my application project, but the project can’t import package which come from smack jars.

So what’s the right way to import smack?

Importing those modules in the smack project to my application project?

Use gradle dependencies as described in the Smack 4.1 README.

I include those dependencies in gradle file like following:

compile “org.igniterealtime.smack:smack-android:4.2.0”
// Optional for XMPPTCPConnection
compile “org.igniterealtime.smack:smack-tcp:4.2.0”
// Optional for XMPP-IM (RFC 6121) support (Roster, Threaded Chats, …)
compile “org.igniterealtime.smack:smack-im:4.2.0”
// Optional for XMPP extensions support
compile “org.igniterealtime.smack:smack-extensions:4.2.0”

When I build, it tells me:

Failed to resolve:org.igniterealtime.smack:smack-android:4.2.0

Failed to …

The name of jar is:


I include those jars like this:

compile files(‘libs/smack-android-4.2.0-beta2-SNAPSHOT-sources.jar’)

// Optional for XMPPTCPConnection
compile files(‘libs/smack-core-4.2.0-beta2-SNAPSHOT-sources.jar’)

// Optional for XMPP-IM (RFC 6121) support (Roster, Threaded Chats, …)
compile files(‘libs/smack-tcp-4.2.0-beta2-SNAPSHOT-sources.jar’)

// Optional for XMPP extensions support
compile files(‘libs/smack-extensions-4.2.0-beta2-SNAPSHOT-sources.jar’)

This time it doesn’t show " Failed to".

But it shows “package org.jivesoftware.smack is existed”

There is no version ‘4.2.0’. Smack 4.2 hasn’t been released yet. Try ‘4.2.0-beta1’.


Hi, @Flow, whats is the latest version to use 4.2.0 with gradle ?

Look at Maven Central (search.maven.org) for the latest version.