Die Integration von Smack mit Android Studio Projekt für die chat-Anwendung

Bin ich versucht zu implementieren eine chat-messenger mit ejabberd-server und der smack-Bibliothek, aber habe eine harte Zeit, sich zu integrieren, alle Gläser und Abhängigkeiten von smack. Ich bin mit android Studio.

Meine bauen.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'

    }

Erstens war ich immer XMLpullparser Fehler dann habe ich die xpp3. Aber nachdem ich Hinzugefügt xpp3 ich bin immer

Error:Gradle: Execution failed for 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 with non-zero exit value 1

bauen.gradle(Projekt):

//Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.2'



        //NOTE: Do not place your application dependencies here; they belong
        //in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://oss.sonatype.org/content/repositories/snapshots'
        }
        mavenCentral()
    }

}

Fragen:

How um den Fehler zu entfernen oder was kann die Ursache des Fehlers. Ich könnte fehlt eine gewisse Abhängigkeit ?

Mit Kittel, erhöht sich die app-Größe. kann ich erreichen, IM ohne Bibliothek und schreiben von server-side-code statt.
Wie mit ejabberd-Bibliothek für node-js und die android-app zu sprechen, um nodejs statt ejabberd?

Und ja ich habe noch was :

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");

    }


}

Ich bin immer der Fehler wenn ich auf die XMPPClient Klasse

InformationsquelleAutor no one | 2015-07-07
Schreibe einen Kommentar