找不到提供程序类 SMACK 4.1.1 Android

Posted

技术标签:

【中文标题】找不到提供程序类 SMACK 4.1.1 Android【英文标题】:Could not find provider class SMACK 4.1.1 Android 【发布时间】:2015-12-04 08:36:16 【问题描述】:

我是 android 开发和 Smack 的新手,我使用的是来自 link 的示例代码。但是当我尝试使用 smack 4.1.1 api 时,在低于 22 的 API 级别上运行应用程序时出现类未找到错误。

以下是我收到错误的代码部分:

    XMPPTCPConnectionConfiguration.Builder config = XMPPTCPConnectionConfiguration
            .builder(); // In this line 
    config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
    config.setServiceName(serverAddress);
    config.setHost(serverAddress);
    config.setPort(5222);
    config.setDebuggerEnabled(true);
    XMPPTCPConnection.setUseStreamManagementResumptiodDefault(true);
    XMPPTCPConnection.setUseStreamManagementDefault(true);
    connection = new XMPPTCPConnection(config.build());
    XMPPConnectionListener connectionListener = new XMPPConnectionListener();
    connection.addConnectionListener(connectionListener);

这是我的 gradle 文件依赖列表:

dependencies 
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'org.jxmpp:jxmpp-util-cache:0.5.0-alpha7'
compile 'org.igniterealtime.smack:smack-android:4.1.1'
compile 'org.igniterealtime.smack:smack-tcp:4.1.1'
// optional features
compile 'org.igniterealtime.smack:smack-android-extensions:4.1.1'
compile 'org.igniterealtime.smack:smack-core:4.1.1'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.android.gms:play-services:8.3.0'

以下是我得到的错误:

    12-04 13:52:14.782 7566-7582/com.society.societytabs E/GMPM: getGoogleAppId failed with status: 10
12-04 13:52:14.784 7566-7582/com.society.societytabs E/GMPM: Uploading is not possible. App measurement disabled
12-04 13:52:15.812 7566-7566/com.society.societytabs E/dalvikvm: Could not find class 'org.jxmpp.util.cache.ExpirationCache', referenced from method org.jivesoftware.smack.util.dns.minidns.MiniDnsResolver.<clinit>
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader: Could not find provider class
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader: java.lang.ClassNotFoundException: Didn't find class "org.jivesoftware.smackx.time.provider.TimeProvider" on path: DexPathList[[zip file "/data/app/com.society.societytabs-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.society.societytabs-1, /vendor/lib, /system/lib]]
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.provider.ProviderFileLoader.<init>(ProviderFileLoader.java:77)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.initializer.UrlInitializer.initialize(UrlInitializer.java:53)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.loadSmackClass(SmackInitialization.java:232)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.parseClassesToLoad(SmackInitialization.java:193)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:163)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:148)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.<clinit>(SmackInitialization.java:116)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackConfiguration.getVersion(SmackConfiguration.java:96)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.ConnectionConfiguration.<clinit>(ConnectionConfiguration.java:38)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.initialiseConnection(MyXMPP.java:102)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.init(MyXMPP.java:95)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.<init>(MyXMPP.java:61)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.getInstance(MyXMPP.java:69)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyService.onCreate(MyService.java:34)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2585)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread.access$1800(ActivityThread.java:139)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.os.Handler.dispatchMessage(Handler.java:102)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.os.Looper.loop(Looper.java:136)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread.main(ActivityThread.java:5086)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.reflect.Method.invokeNative(Native Method)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.reflect.Method.invoke(Method.java:515)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
12-04 13:52:15.825 7566-7566/com.society.societytabs E/ProviderFileLoader:     at dalvik.system.NativeStart.main(Native Method)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader: Could not find provider class
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader: java.lang.ClassNotFoundException: Didn't find class "org.jivesoftware.smackx.xhtmlim.provider.XHTMLExtensionProvider" on path: DexPathList[[zip file "/data/app/com.society.societytabs-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.society.societytabs-1, /vendor/lib, /system/lib]]
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.provider.ProviderFileLoader.<init>(ProviderFileLoader.java:77)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.initializer.UrlInitializer.initialize(UrlInitializer.java:53)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.loadSmackClass(SmackInitialization.java:232)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.parseClassesToLoad(SmackInitialization.java:193)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:163)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:148)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.<clinit>(SmackInitialization.java:116)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackConfiguration.getVersion(SmackConfiguration.java:96)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.ConnectionConfiguration.<clinit>(ConnectionConfiguration.java:38)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.initialiseConnection(MyXMPP.java:102)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.init(MyXMPP.java:95)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.<init>(MyXMPP.java:61)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.getInstance(MyXMPP.java:69)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyService.onCreate(MyService.java:34)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2585)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread.access$1800(ActivityThread.java:139)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.os.Handler.dispatchMessage(Handler.java:102)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.os.Looper.loop(Looper.java:136)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread.main(ActivityThread.java:5086)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.reflect.Method.invokeNative(Native Method)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.reflect.Method.invoke(Method.java:515)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
12-04 13:52:15.828 7566-7566/com.society.societytabs E/ProviderFileLoader:     at dalvik.system.NativeStart.main(Native Method)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader: Could not find provider class
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader: java.lang.ClassNotFoundException: Didn't find class "org.jivesoftware.smackx.muc.packet.GroupChatInvitation$Provider" on path: DexPathList[[zip file "/data/app/com.society.societytabs-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.society.societytabs-1, /vendor/lib, /system/lib]]
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.provider.ProviderFileLoader.<init>(ProviderFileLoader.java:77)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.initializer.UrlInitializer.initialize(UrlInitializer.java:53)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.loadSmackClass(SmackInitialization.java:232)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.parseClassesToLoad(SmackInitialization.java:193)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:163)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:148)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.<clinit>(SmackInitialization.java:116)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackConfiguration.getVersion(SmackConfiguration.java:96)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.ConnectionConfiguration.<clinit>(ConnectionConfiguration.java:38)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.initialiseConnection(MyXMPP.java:102)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.init(MyXMPP.java:95)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.<init>(MyXMPP.java:61)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.getInstance(MyXMPP.java:69)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyService.onCreate(MyService.java:34)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2585)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread.access$1800(ActivityThread.java:139)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.os.Handler.dispatchMessage(Handler.java:102)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.os.Looper.loop(Looper.java:136)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread.main(ActivityThread.java:5086)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.reflect.Method.invokeNative(Native Method)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.reflect.Method.invoke(Method.java:515)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
12-04 13:52:15.830 7566-7566/com.society.societytabs E/ProviderFileLoader:     at dalvik.system.NativeStart.main(Native Method)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader: Could not find provider class
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader: java.lang.ClassNotFoundException: Didn't find class "org.jivesoftware.smackx.xdata.provider.DataFormProvider" on path: DexPathList[[zip file "/data/app/com.society.societytabs-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.society.societytabs-1, /vendor/lib, /system/lib]]
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.provider.ProviderFileLoader.<init>(ProviderFileLoader.java:77)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.initializer.UrlInitializer.initialize(UrlInitializer.java:53)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.loadSmackClass(SmackInitialization.java:232)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.parseClassesToLoad(SmackInitialization.java:193)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:163)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:148)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackInitialization.<clinit>(SmackInitialization.java:116)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.SmackConfiguration.getVersion(SmackConfiguration.java:96)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at org.jivesoftware.smack.ConnectionConfiguration.<clinit>(ConnectionConfiguration.java:38)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.initialiseConnection(MyXMPP.java:102)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.init(MyXMPP.java:95)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.<init>(MyXMPP.java:61)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyXMPP.getInstance(MyXMPP.java:69)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.society.societytabs.Application.MyService.onCreate(MyService.java:34)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2585)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread.access$1800(ActivityThread.java:139)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.os.Handler.dispatchMessage(Handler.java:102)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.os.Looper.loop(Looper.java:136)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at android.app.ActivityThread.main(ActivityThread.java:5086)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.reflect.Method.invokeNative(Native Method)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at java.lang.reflect.Method.invoke(Method.java:515)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
12-04 13:52:15.833 7566-7566/com.society.societytabs E/ProviderFileLoader:     at dalvik.system.NativeStart.main(Native Method)

编辑 1: 在检查了大约 8-10 小时后,我发现问题出在 Smack 扩展库上。你能帮我解决这个问题吗?

【问题讨论】:

再次同步您的项目,然后再尝试。 也为了开始 smack 我建议你使用这个网站:igniterealtime.org/builds/smack/docs/latest/documentation/… 并且只使用我说的库。这是我的依赖 smack 库: compile "org.igniterealtime.smack:smack-android-extensions:4.1.0" compile "org.igniterealtime.smack:smack-experimental:4.1.0" compile "org.igniterealtime.smack:smack -tcp:4.1.0" 感谢 Prera​​k,但我已经尝试同步项目,但仍然遇到同样的错误。 我使用的其他库是appcompat、support和Using Glide to load image,我使用的其他库是谷歌提供的gson和play服务库。我也尝试删除它们,但仍然出现错误。 【参考方案1】:

最后我解决了这个问题。发布解决方案以帮助遇到同样问题的任何人。 smack 扩展库存在问题。如果将它们与 google play 服务库一起使用,则会在 KITKAT (api 19) 或以下设备的设备上引发错误。 要让代码运行,请替换

compile 'com.google.android.gms:play-services:8.3.0'

使用您将要从播放服务中使用的库。就我而言,我需要 play 和 gcm 库。下面是他们的代码:

compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services-plus:8.3.0'

以下是 google play 服务库的完整列表: https://developers.google.com/android/guides/setup

【讨论】:

真棒答案@Sheryash Jain 花了两天时间后,我找到了你的答案,非常感谢

以上是关于找不到提供程序类 SMACK 4.1.1 Android的主要内容,如果未能解决你的问题,请参考以下文章

在 ProviderRepository.php 第 208 行中找不到提供程序类

Android Studio 中的 Smack 让我很困惑

Smack - 何时调用 MultiUserChat.Join(...)

适用于 blob 的 Azure Java SDK - 已请求加载默认 HttpClient 提供程序,但在类路径中找不到该提供程序

如何在 smack 中实现消息确认

找不到提供程序类:运行Jersey REST服务时