Eclipse 集成 EaseUI 库报错,NoClassDefFoundError

一个老项目,需要即时通讯功能,于是打算使用环信,为了省事,决定使用 EaseUI 库。
操作如下:
1.官网下载SDK,解压后如下:

001.png

 
2.删除了与gradle相关的文件,导入Eclipse后目录结构如下:

002.png

 
3.在我的项目中进行了如下配置;

003.png


004.png

 
4.右键,运行到手机后,程序报错,如下:
04-15 15:42:15.104: D/AndroidRuntime(5714): Shutting down VM
04-15 15:42:15.105: E/AndroidRuntime(5714): FATAL EXCEPTION: main
04-15 15:42:15.105: E/AndroidRuntime(5714): Process: com.onion, PID: 5714
04-15 15:42:15.105: E/AndroidRuntime(5714): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/umeng/socialize/PlatformConfig;
04-15 15:42:15.105: E/AndroidRuntime(5714): at pub.config.MxApplication.<init>(MxApplication.java:51)
04-15 15:42:15.105: E/AndroidRuntime(5714): at java.lang.Class.newInstance(Native Method)
04-15 15:42:15.105: E/AndroidRuntime(5714): at android.app.Instrumentation.newApplication(Instrumentation.java:997)
04-15 15:42:15.105: E/AndroidRuntime(5714): at android.app.Instrumentation.newApplication(Instrumentation.java:982)
04-15 15:42:15.105: E/AndroidRuntime(5714): at android.app.LoadedApk.makeApplication(LoadedApk.java:575)
04-15 15:42:15.105: E/AndroidRuntime(5714): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4699)
04-15 15:42:15.105: E/AndroidRuntime(5714): at android.app.ActivityThread.access$1600(ActivityThread.java:153)
04-15 15:42:15.105: E/AndroidRuntime(5714): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
04-15 15:42:15.105: E/AndroidRuntime(5714): at android.os.Handler.dispatchMessage(Handler.java:102)
04-15 15:42:15.105: E/AndroidRuntime(5714): at android.os.Looper.loop(Looper.java:148)
04-15 15:42:15.105: E/AndroidRuntime(5714): at android.app.ActivityThread.main(ActivityThread.java:5438)
04-15 15:42:15.105: E/AndroidRuntime(5714): at java.lang.reflect.Method.invoke(Native Method)
04-15 15:42:15.105: E/AndroidRuntime(5714): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
04-15 15:42:15.105: E/AndroidRuntime(5714): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
04-15 15:42:15.105: E/AndroidRuntime(5714): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.umeng.socialize.PlatformConfig" on path: DexPathList[[zip file "/data/app/com.onion-2/base.apk"],nativeLibraryDirectories=[/data/app/com.onion-2/lib/arm, /data/app/com.onion-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
04-15 15:42:15.105: E/AndroidRuntime(5714): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
04-15 15:42:15.105: E/AndroidRuntime(5714): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-15 15:42:15.105: E/AndroidRuntime(5714): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
04-15 15:42:15.105: E/AndroidRuntime(5714): ... 14 more
04-15 15:42:15.105: E/AndroidRuntime(5714): Suppressed: java.lang.ClassNotFoundException: com.umeng.socialize.PlatformConfig
04-15 15:42:15.105: E/AndroidRuntime(5714): at java.lang.Class.classForName(Native Method)
04-15 15:42:15.105: E/AndroidRuntime(5714): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
04-15 15:42:15.105: E/AndroidRuntime(5714): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
04-15 15:42:15.105: E/AndroidRuntime(5714): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
04-15 15:42:15.105: E/AndroidRuntime(5714): ... 15 more
04-15 15:42:15.105: E/AndroidRuntime(5714): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
04-15 15:42:17.488: I/Process(5714): Sending signal. PID: 5714 SIG: 9

附:

005.png


006.png


007.png

 
package pub.config;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import pub.util.CrashLogUtils;
import pub.util.Graph;
import pub.util.file.FileUtil;
import android.annotation.TargetApi;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.support.multidex.MultiDex;
import cn.jpush.android.api.JPushInterface;
import cn.smssdk.SMSSDK;

import com.alibaba.sdk.android.oss.OSSClient;
import com.alibaba.sdk.android.oss.model.AccessControlList;
import com.alibaba.sdk.android.oss.model.TokenGenerator;
import com.alibaba.sdk.android.oss.util.OSSToolKit;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import com.baidu.mapapi.SDKInitializer;
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache;
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
import com.onion.R;
import com.onion.cim.client.android.CIMPushManager;
import com.umeng.analytics.MobclickAgent;
import com.umeng.analytics.MobclickAgent.EScenarioType;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;

/**
* 核心配置文件
* @author ChenWenGuan
*
*/
public class MxApplication extends Application {
// 通过代码块初始化各个应用的 APPKey
{
// Config.DEBUG = true; // 分享的 DeBug 开关
//微信
PlatformConfig.setWeixin(GlobalConfig.WX_APP_ID, GlobalConfig.WX_APP_SECRET);
//QQ
PlatformConfig.setQQZone(GlobalConfig.QQ_APP_ID, GlobalConfig.QQ_APP_KEY);
}

private static Context applicationContext;

public static RequestQueue volleyQueue; //Volley的Http请求队列

//聊天表情符
public static List<String> emoticonList = new ArrayList<String>();
public static Map<String, Integer> emoticonsIdMap = new HashMap<String, Integer>();
public static List<String> emoticonKeyList = new ArrayList<String>();

//聊天表情符
public static List<String> emoticonGifList = new ArrayList<String>();
public static Map<String, Integer> emoticonsGifIdMap = new HashMap<String, Integer>();
public static List<String> emoticonGifKeyList = new ArrayList<String>();

//OSS文件存储关键字
public static String GLOBAL_MODEL_KEY = "GLOBAL_MODEL_KEY";
public static String OSS_ACCESS_ID ="OSS_ACCESS_ID";
public static String OSS_ACCESS_KEY = "OSS_ACCESS_KEY";

@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@Override
public void onCreate() {
super.onCreate();
applicationContext = getApplicationContext();

// 初始化极光推送
JPushInterface.init(this);
// 初始化友盟分享
UMShareAPI.get(this);
// 友盟集成测试
// MobclickAgent.setDebugMode(true);
// 友盟:设置统计类型
MobclickAgent.setScenarioType(applicationContext, EScenarioType.E_UM_NORMAL);

volleyQueue = Volley.newRequestQueue(getApplicationContext()); //建立Volley的Http请求队列

SMSSDK.initSDK(this, GlobalConfig.SMSSDK_APPKEY, GlobalConfig.SMSSDK_APPSECRET); //初始化SMSSDK短信
SDKInitializer.initialize(getApplicationContext()); //初始化百度地图

Graph.initUILOption(); //加载方形图片
Graph.initUILOption_360(); //加载圆形图片

setOssAccessID(GlobalConfig.OSS_ACCESS_ID);
setOssAccessKey(GlobalConfig.OSS_ACCESS_KEY);

//新建文件目录
FileUtil.creatSDDir(GlobalConfig.CACHE_DIR);
FileUtil.creatSDDir(GlobalConfig.DOWNLOAD_DIR);
FileUtil.creatSDDir(GlobalConfig.LOG_DIR);

initOSSConfig();
initImageLoader();
initEmotions();
initGifEmotions();
CrashLogUtils.getInstace().uploadCrashLogFile();

}

@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}

/**
* 开放Volley的HTTP请求队列接口
* @return
*/
public static RequestQueue getRequestQueue() {
return volleyQueue;
}

private void initOSSConfig() {
OSSClient.setGlobalDefaultTokenGenerator(new TokenGenerator() {
@Override
public String generateToken(String httpMethod, String md5, String type, String date, String ossHeaders,String resource) {

String content = httpMethod + "\n" + md5 + "\n" + type + "\n" + date
+ "\n" + ossHeaders + resource;
String ossAccessID = getOssAccessID();
String ossAccessKey = getOssAccessKey();
String token = OSSToolKit.generateToken(ossAccessID, ossAccessKey, content);

return token;
}
});

OSSClient.setGlobalDefaultACL(AccessControlList.PUBLIC_READ_WRITE);
OSSClient.setGlobalDefaultHostId("oss-cn-shenzhen.aliyuncs.com"); //指明bucket是放在华南地区深圳数据中心
OSSClient.setApplicationContext(getApplicationContext());
}

/**
* 授权信息
* @param key
*/
public static void setOssAccessID(String key) {
SharedPreferences sp = applicationContext.getSharedPreferences(GLOBAL_MODEL_KEY, Context.MODE_PRIVATE);
sp.edit().putString(OSS_ACCESS_ID, key).commit();
}
public static String getOssAccessID() {
SharedPreferences sp = applicationContext.getSharedPreferences(GLOBAL_MODEL_KEY, Context.MODE_PRIVATE);
return sp.getString(OSS_ACCESS_ID, null);

}
public static void setOssAccessKey(String key) {
SharedPreferences sp = applicationContext.getSharedPreferences(GLOBAL_MODEL_KEY, Context.MODE_PRIVATE);
sp.edit().putString(OSS_ACCESS_KEY, key).commit();
}
public static String getOssAccessKey() {
SharedPreferences sp = applicationContext.getSharedPreferences(GLOBAL_MODEL_KEY, Context.MODE_PRIVATE);
return sp.getString(OSS_ACCESS_KEY, null);
}


// public static List<Activity> aliveActivitys = new ArrayList<Activity>(); //存活的Activity

/**
* 结束所有Activity
*/
public static void finishAllActivity() {
// 保存友盟统计的数据
MobclickAgent.onKillProcess(applicationContext);
// System.exit(0);
}

/**
* 初始化图片加载器
*/
public void initImageLoader() {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.threadPriority(Thread.NORM_PRIORITY - 2)
.diskCache(new UnlimitedDiscCache(new File(GlobalConfig.CACHE_DIR),new File(GlobalConfig.CACHE_DIR),new Md5FileNameGenerator()))
.denyCacheImageMultipleSizesInMemory() //当同一个Uri获取不同大小的图片,缓存到内存时,只缓存一个。默认会缓存多个不同的大小的相同图片
.diskCacheFileCount(1000) //缓存文件的最大个数
.tasksProcessingOrder(QueueProcessingType.LIFO)//设置图片下载和显示的工作队列排序
.memoryCache(new WeakMemoryCache())
.memoryCacheSize(2 * 1024 * 1024) // 限定内存缓存的大小
.memoryCacheExtraOptions(300, 300)
.threadPoolSize(3)
.build();

ImageLoader.getInstance().init(config);
}

/**
* 初始化表情符
*/
private void initEmotions() {
emoticonList.addAll(Arrays.asList(this.getResources().getStringArray(R.array.emoticos)));
emoticonKeyList.addAll(Arrays.asList(this.getResources().getStringArray(R.array.emoticoKeys)));

for (int i = 0 ;i < emoticonKeyList.size();i++) {
int emoticonsId = getResources().getIdentifier(emoticonList.get(i),"drawable", getPackageName());
emoticonsIdMap.put(emoticonKeyList.get(i), emoticonsId);
}
}

/**
* @author linmo
* 初始化 Gif 表情
*/
private void initGifEmotions(){
emoticonGifList.addAll(Arrays.asList(this.getResources().getStringArray(R.array.emoticosGif)));
emoticonGifKeyList.addAll(Arrays.asList(this.getResources().getStringArray(R.array.emoticoKeysGif)));

for (int i = 0 ;i < emoticonGifKeyList.size();i++) {
int emoticonsId = getResources().getIdentifier(emoticonGifList.get(i),"drawable", getPackageName());
emoticonsGifIdMap.put(emoticonGifKeyList.get(i), emoticonsId);
}
}

/**
* 获取applicationContext
* @return
*/
public static Context getInstance(){
return applicationContext;
}

}

 <!-- SDK最小版本:15; SDK目标版本:18 -->
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="18" />

 
已邀请:

Wxin

赞同来自:

看提示应该是友盟的报错,去把友盟的so目录和easeui的so目录统一下

要回复问题请先登录注册

知识价值的认可,源自您的赞赏

扫描二维码,你的支付将由imGeek代收后转给对方

×