在IOS上都没有这个问题,但是在IOS上好像很容易出现,我现在用的是3.3版本,游戏运行过程中出现了2个崩溃,都跟java内部的hashmap有关系,崩溃日子如下:
1、
07-24 16:29:35.289: A/art(15102): art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: JNI NewStringUTF called with pending exception ‘java.util.ConcurrentModificationException’ thrown in java.util.HashMap$HashMapEntry java.util.HashMap$HashIterator.nextEntry():787
07-24 16:29:35.289: A/art(15102): art/runtime/check_jni.cc:65] in call to NewStringUTF
07-24 16:29:35.289: A/art(15102): art/runtime/check_jni.cc:65] from void org.cocos2dx.lib.Cocos2dxRenderer.nativeRender()
07-24 16:29:35.289: A/art(15102): art/runtime/check_jni.cc:65] “GLThread 12809” prio=5 tid=20 Runnable
07-24 16:29:35.289: A/art(15102): art/runtime/check_jni.cc:65] | group=“main” sCount=0 dsCount=0 obj=0x12ca3590 self=0xab1e0aa0
07-24 16:29:35.289: A/art(15102): art/runtime/check_jni.cc:65] | sysTid=15150 nice=0 cgrp=apps sched=0/0 handle=0xab1e10e0
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] | state=R schedstat=( 239166194795 39977159881 241244 ) utm=21406 stm=2510 core=6 HZ=100
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] | stack=0xe4527000-0xe4529000 stackSize=1036KB
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] | held mutexes= “mutator lock”(shared held)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #00 pc 00004640 /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #01 pc 00002e8d /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #02 pc 0023f355 /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits >&, int, char const*, art::mirror::ArtMethod*)+68)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #03 pc 00224517 /system/lib/libart.so (art::Dump(std::__1::basic_ostream<char, std::__1::char_traits >&) const+146)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #04 pc 000af983 /system/lib/libart.so (art::JniAbort(char const*, char const*)+582)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #05 pc 000b00bd /system/lib/libart.so (art::JniAbortF(char const*, char const*, …)+60)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #06 pc 000b31cd /system/lib/libart.so (art::ScopedCheck::ScopedCheck(JNIEnv*, int, char const*)+1284)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #07 pc 000baf71 /system/lib/libart.so (art::CheckJNI::NewStringUTF(JNIEnv*, char const*)+20)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #08 pc 0028389f /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (getClassID(char const*)+22)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #09 pc 00283927 /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (cocos2d::JniHelper::getStaticMethodInfo(cocos2d::JniMethodInfo&, char const*, char const*, char const*)+50)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #10 pc 00281b8b /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (cocos2d::Device::getTextureDataForText(char const*, cocos2d::FontDefinition const&, cocos2d::Device::TextAlign, int&, int&, bool&)+118)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #11 pc 00485221 /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (cocos2d::Texture2D::initWithString(char const*, cocos2d::FontDefinition const&)+264)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #12 pc 00436589 /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (cocos2d::createSpriteWithFontDefinition()+120)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #13 pc 0043722d /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (cocos2d::updateContent()+332)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #14 pc 00437ee7 /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (cocos2d::getContentSize() const+34)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #15 pc 004391db /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (cocos2d::LabelTTF::visit(cocos2d::Renderer*, cocos2d::Mat4 const&, unsigned int)+38)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #16 pc 004418b5 /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (cocos2d::Node::visit(cocos2d::Renderer*, cocos2d::Mat4 const&, unsigned int)+218)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #17 pc 004418b5 /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (cocos2d::Node::visit(cocos2d::Renderer*, cocos2d::Mat4 const&, unsigned int)+218)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #18 pc 004418b5 /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (cocos2d::Node::visit(cocos2d::Renderer*, cocos2d::Mat4 const&, unsigned int)+218)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #19 pc 0044e53f /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (cocos2d::Scene::render(cocos2d::Renderer*)+186)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #20 pc 0046feab /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (cocos2d::Director::drawScene()+142)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #21 pc 0046ff59 /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (cocos2d::DisplayLinkDirector::mainLoop()+28)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #22 pc 002835f3 /data/app/com.taiqi.sl.fsn-1/lib/arm/libcocos2dlua.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender+10)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] native: #23 pc 00160699 /data/dalvik-cache/arm/data@app@com.taiqi.sl.fsn-1@base.apk@classes.dex (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender+80)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] at org.cocos2dx.lib.Cocos2dxRenderer.nativeRender(Native method)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] at org.cocos2dx.lib.Cocos2dxRenderer.onDrawFrame(Cocos2dxRenderer.java:110)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522)
07-24 16:29:35.299: A/art(15102): art/runtime/check_jni.cc:65] at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)
2、
07-24 16:58:20.420: W/AudioTrack(16210): AUDIO_OUTPUT_FLAG_FAST denied by client
07-24 16:58:20.420: I/SmartAudioService(6747): getCreatePid -> track - 0xab914e40, calling pid - 0x3f52
07-24 16:58:20.430: W/AudioTrack(16210): AUDIO_OUTPUT_FLAG_FAST denied by client
07-24 16:58:20.430: I/SmartAudioService(6747): getCreatePid -> track - 0xab4a2a90, calling pid - 0x3f52
07-24 16:58:20.480: E/AndroidRuntime(16210): FATAL EXCEPTION: GLThread 12814
07-24 16:58:20.480: E/AndroidRuntime(16210): Process: com.taiqi.sl.fsn, PID: 16210
07-24 16:58:20.480: E/AndroidRuntime(16210): java.util.ConcurrentModificationException
07-24 16:58:20.480: E/AndroidRuntime(16210): at java.util.HashMap$HashIterator.nextEntry(HashMap.java:787)
07-24 16:58:20.480: E/AndroidRuntime(16210): at java.util.HashMap$EntryIterator.next(HashMap.java:824)
07-24 16:58:20.480: E/AndroidRuntime(16210): at java.util.HashMap$EntryIterator.next(HashMap.java:822)
07-24 16:58:20.480: E/AndroidRuntime(16210): at org.cocos2dx.lib.Cocos2dxSound.setEffectsVolume(Cocos2dxSound.java:265)
07-24 16:58:20.480: E/AndroidRuntime(16210): at org.cocos2dx.lib.Cocos2dxHelper.setEffectsVolume(Cocos2dxHelper.java:249)
07-24 16:58:20.480: E/AndroidRuntime(16210): at org.cocos2dx.lib.Cocos2dxRenderer.nativeTouchesEnd(Native Method)
07-24 16:58:20.480: E/AndroidRuntime(16210): at org.cocos2dx.lib.Cocos2dxRenderer.handleActionUp(Cocos2dxRenderer.java:141)
07-24 16:58:20.480: E/AndroidRuntime(16210): at org.cocos2dx.lib.Cocos2dxGLSurfaceView$9.run(Cocos2dxGLSurfaceView.java:257)
07-24 16:58:20.480: E/AndroidRuntime(16210): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)
07-24 16:58:20.480: E/AndroidRuntime(16210): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)
07-24 16:58:20.480: W/ActivityManager(915): Force finishing activity com.taiqi.sl.fsn/com.sandglass.fsn.AppActivity
07-24 16:58:20.490: E/ImeManager(915): System would not have a null focused window on display;0
07-24 16:58:20.530: D/AudioPolicyManagerUtil(6747): set device connection: 33, 0, 0, 0, -1
不知道有没有大神解决了这个问题,谢谢