刚刚朋友让我帮忙看一下他的游戏为啥打包Android之后闪退, 在PC上正常, 跟了一下之后, 发现问题出在了tinyxml2上面, 他是这样写的

tinyxml2::XMLDocument* doc = new tinyxml2::XMLDocument();XMLError errorID = doc->LoadFile("config.xml");XMLElement* root = doc->RootElement();

在PC上LoadFile能正常找到XML解析, 但是在Android上就找不到这个XML了, 改成这样加载就行了

tinyxml2::XMLDocument* doc = new tinyxml2::XMLDocument();ssize_t bufferSize;auto pBuffer = CCFileUtils::sharedFileUtils()->getFileData("config.xml", "rb", &bufferSize);int error = doc->Parse((const char*)pBuffer);pBuffer[(int)bufferSize - 1] = '\0';XMLElement* root = doc->RootElement();





更多相关文章

  1. Android中Http加载如何得到Cookie和 WebView 加载网页如何得到的
  2. android异步任务加载数据界面实现
  3. android:加载html,太宽,适配解决方案。
  4. android studio加载so文件报错:dalvik.system.PathClassLoadero
  5. 使用viewpager切换fragment加载两个webview时卡顿
  6. [置顶] 美团Android DEX自动拆包及动态加载简介
  7. android大图加载中的陷阱
  8. android动态加载apk

随机推荐

  1. Android-Adapter适配器
  2. Intellij Idea gradle Android(安卓)depe
  3. Android:apk签名
  4. 安卓入门 之 开发环境搭建
  5. Android(安卓)RecyclerView 的点击事件
  6. android一键退出
  7. Android的TextView与Html相结合的用法
  8. android:process的最大的坑
  9. Android关于RecycleView不走onBindViewHo
  10. Android启动过程图解