Android上进程闪退,读取Manifest.xml配置文件出错

Android上进程闪退,都是在jni调用java代码处异常
09-12 09:50:43.368: I/DEBUG(20447):     #00  pc 000568de  /system/lib/libdvm.so (dvmCreateCstrFromString(StringObject const*)+29)
09-12 09:50:43.368: I/DEBUG(20447):     #01  pc 0004c375  /system/lib/libdvm.so
09-12 09:50:43.368: I/DEBUG(20447):     #02  pc 002153eb  /data/app-lib/com.cldeer.bubblebear-1/libbubblebear.so (ClientInterfaceAndroid::getUMengChannel()+70)
09-12 09:50:43.368: I/DEBUG(20447):     #03  pc 002156bd  /data/app-lib/com.cldeer.bubblebear-1/libbubblebear.so (ClientOnlineCfg::getWebCfgByName(char const*)+44)
09-12 09:50:43.368: I/DEBUG(20447):     #04  pc 001c6b8d  /data/app-lib/com.cldeer.bubblebear-1/libbubblebear.so (AppDelegate::applicationDidFinishLaunching()+92)
09-12 09:50:43.368: I/DEBUG(20447):     #05  pc 00251ad3  /data/app-lib/com.cldeer.bubblebear-1/libbubblebear.so (cocos2d::CCApplication::run()+6)
09-12 09:50:43.368: I/DEBUG(20447):     #06  pc 001c3479  /data/app-lib/com.cldeer.bubblebear-1/libbubblebear.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit+108)
排查一:
前面以更换包名的版本编译过,随便修改一下main.cpp然后重新编译,问题没解决
排查二:
还是怀疑包名的问题,修改jni中包名为错误包名,对比出错内容,报错内容不同。不过对定位没有帮助
排查三:
关键地方打印日志信息,
public static String getDeviceToken() {
Log.e("=======", "==================================kkkkkkkkkkkkkkkkk"); 
String xx = sCldComm.getDeviceInfo2(); 
Log.e("=======", "==========================" + xx); 
return xx; 
}
发现下面异常信息
09-12 10:45:20.654: D/UmJniHelper(26074): Failed to find class of com/umeng/analytics/MobclickAgent
09-12 10:45:20.654: D/UmJniHelper(26074): Failed to find static method id of onResume
09-12 10:45:20.654: D/UmJniHelper(26074): Failed to find class of com/umeng/analytics/MobclickAgent
09-12 10:45:20.654: D/UmJniHelper(26074): Failed to find static method id of updateOnlineConfig
09-12 10:45:20.654: W/dalvikvm(26074): Exception thrown (Ljava/lang/NoClassDefFoundError;) while throwing internal exception (Ljava/lang/NoSuchMethodError;)
09-12 10:45:20.654: D/JniHelper(26074): Failed to find static method id of getUMengChannelxxxxx
09-12 10:45:20.654: E/=======(26074): ==================================kkkkkkkkkkkkkkkkk
09-12 10:45:20.654: E/dalvikvm(26074): JNI ERROR (app bug): accessed stale local reference 0x3d (index 15 in a table of size 5)
09-12 10:45:20.654: E/dalvikvm(26074): VM aborting
在java函数里面出的问题,并不是jni调用间的问题,最终跟踪getDeviceInfo2函数定位到问题处
ApplicationInfo appInfo;
appInfo = pm.getApplicationInfo(activity.getPackageName(), PackageManager.GET_META_DATA);
//String value = appInfo.metaData.getString(name);    
// Manifest.xml中配置会转为Bundle结构,而该结构有类型区别。数字类型值默认转为int
// 这里使用getString导致最终失败
// 最新修改是先获取Object对象,然后通过toString转化
Object obj = appInfo.metaData.get(name); 
return obj.toString(); 

你可能感兴趣的:(问题定位)