我有一个使用android-ndk-r9c和当前android sdk构建的复杂应用程序,当启用checkjni时失败,因为它默认情况下在大多数现代的dalvik虚拟机(后冰淇淋三明治,即。 4.0.0)android设备。我的应用程序在模拟器上正常运行,如果运行“adb -e shell stop / adb -e shell setprop dalvik.vm.checkjni false / adb -e shell start”,但崩溃(checkJNI app bug)错误,作为JNI启动java代码使用的是本地(非“全局”)指针。
这个dalvik虚拟机架构发生了几年前的变化,并且在我发现的一些“JNI技巧”文件中有所提及,但是我试图用“GLSurfaceView_SDL.java”代码来全局化指针得分(呃)少。 (我不是c ++大师,甚至不是新手...)
我附上了两个文件。首先显示两个“adb logcat”片段,第一个应用程序启动并运行并退出ok,第二个,启用“checkjni”,并且它崩溃“dalvik”虚拟机,声称“陈旧的本地指针”。有人告诉我,我无法调整应用程序以禁用“checkJNI”引用检查。
所以,我停了下来。触发“陈旧本地指针”引用的代码在GLSurfaceView_SDL.java中,我附加了“class GLThread”的代码。
对于经验丰富的c ++专家来说,这可能不是一个难以解决的问题。我摆弄,使“mGL”处理公开,因为它在“mRenderer.onDrawFrame(mGL);”哪里 我附加的logcat文件中指出了错误的本地引用。 ((logcat output :) GLSurfaceView_SDL $ GLThread.run(GLSurfaceView_SDL.java:946)。
我尝试使用java中的“NewGlobalRef”来制作全局指针是不成功的。 建议表示赞赏。 - 罗斯。
两个文件:1)模拟器的Logcat输出,显示app运行正常,第二个:“checkjni true”,并且dalvik VM崩溃。 2)“GLTHread”类的代码片段,来自“GLSurfaceView_SDL.java”JNI代码,用于设置渲染表面,并将控制传递给本机代码。
Output of "logcat", from 7-inch WSVGA Android Emulator, without checkJNI "feature" enabled.
[ App works *perfectly*, passes significant regression tests, & does no obvious harm... :) ]
--------------------------------------------------------------------------------------------
I/ActivityManager( 1133): Start proc org.gemesys.android.dosbox for activity org.gemesys.android.dosbox/.MainActivity: pid=1946 uid=10052 gids={50052, 3003, 1028, 1015}
D/dalvikvm( 1946): Late-enabling CheckJNI
I/dalvikvm( 1946): Enabling JNI app bug workarounds for target SDK version 5...
V/PhoneStatusBar( 1184): setLightsOn(true)
I/Choreographer( 1133): Skipped 42 frames! The application may be doing too much work on its main thread.
D/dalvikvm( 1946): Added shared lib /data/app-lib/org.gemesys.android.dosbox-1/libsdl-1.2.so 0xb3d8a990
D/dalvikvm( 1946): Added shared lib /data/app-lib/org.gemesys.android.dosbox-1/libsdl_mixer.so 0xb3d8a990
D/dalvikvm( 1946): Added shared lib /data/app-lib/org.gemesys.android.dosbox-1/libsdl_net.so 0xb3d8a990
D/dalvikvm( 1946): Added shared lib /data/app-lib/org.gemesys.android.dosbox-1/libsdl_sound.so 0xb3d8a990
I/System.out( 1946): libSDL: Settings.Load(): enter
I/System.out( 1946): libSDL: Settings.Load(): loaded settings successfully
V/SDL ( 1946): GLSurfaceView_SDL::onResume()
I/System.out( 1946): libSDL: DemoGLSurfaceView.onResume(): mRenderer.mGlSurfaceCreated false mRenderer.mPaused false
V/SDL ( 1946): GLSurfaceView_SDL::EglHelper::start(): creating GL context
V/SDL ( 1946): GLSurfaceView_SDL::EglHelper::createSurface(): creating GL context
D/gralloc_goldfish( 1946): Emulator without GPU emulation detected.
I/System.out( 1946): libSDL: DemoRenderer.onSurfaceCreated(): paused false mFirstTimeStart true
I/libSDL ( 1946): Physical screen resolution is 1024x552, virtual screen 1024x552
D/dalvikvm( 1946): Added shared lib /data/app-lib/org.gemesys.android.dosbox-1/libapplication.so 0xb3d8a990
D/dalvikvm( 1946): Added shared lib /data/app-lib/org.gemesys.android.dosbox-1/libsdl_main.so 0xb3d8a990
I/ActivityManager( 1133): Displayed org.gemesys.android.dosbox/.MainActivity: +4s275ms
D/dalvikvm( 1946): GC_FOR_ALLOC freed 53K, 15% free 2981K/3500K, paused 106ms, total 106ms
D/dalvikvm( 1946): GC_FOR_ALLOC freed 59K, 15% free 2985K/3500K, paused 183ms, total 183ms
I/dalvikvm-heap( 1946): Grow heap (frag case) to 3.040MB for 66973-byte allocation
D/dalvikvm( 1946): WAIT_FOR_CONCURRENT_GC blocked 35ms
I/System.out( 1946): libSDL: setting envvar LANGUAGE to 'en_US'
I/System.out( 1946): libSDL: accelerometer start required: false
I/System.out( 1946): [MCL Debug]: DemoRenderer calling nativeInit with: Glbl.Datadir=> /data/data/org.gemesys.android.dosbox/files and Glbls.CmdLine => dosbox -conf /data/data/org.gemesys.android.dosbox/files/.dosbox/dosbox-0.74.conf Vidcode=> 0
I/libSDL ( 1946): Changing curdir to "/data/data/org.gemesys.android.dosbox/files"
I/libSDL ( 1946): Calling SDL_main("dosbox -conf /data/data/org.gemesys.android.dosbox/files/.dosbox/dosbox-0.74.conf")
I/libSDL ( 1946): param 0 = "dosbox"
I/libSDL ( 1946): param 1 = "-conf"
I/libSDL ( 1946): param 2 = "/data/data/org.gemesys.android.dosbox/files/.dosbox/dosbox-0.74.conf"
I/dosbox ( 1946): conf read:/data/data/org.gemesys.android.dosbox/files/.dosbox/dosbox-0.74.conf
I/libSDL ( 1946): SDL_SetVideoMode(): application requested mode 640x400 OpenGL 0
E/libSDL ( 1946): ERROR: Getting the swap interval is not supported
E/libSDL ( 1946): ERROR: GL_GetAttribute not supported
I/ARMAssembler( 1946): generated scanline__00000177:03010104_00008004_00000000 [100 ipp] (122 ins) at [0xa8ac71f0:0xa8ac73d8] in 0 ns
I/ARMAssembler( 1946): generated scanline__00000177:03545404_00009007_00000000 [144 ipp] (167 ins) at [0xa8ac73e0:0xa8ac767c] in 0 ns
I/ARMAssembler( 1946): generated scanline__00000177:03545404_00009006_00000000 [ 83 ipp] (106 ins) at [0xa8ac7680:0xa8ac7828] in 0 ns
I/ARMAssembler( 1946): generated scanline__00000177:03545404_00009004_00000000 [136 ipp] (159 ins) at [0xa8ac7830:0xa8ac7aac] in 0 ns
I/libSDL ( 1946): ANDROIDAUD_OpenAudio(): app requested audio bytespersample 2 freq 22050 channels 2 samples 1024
I/libSDL ( 1946): ANDROIDAUD_OpenAudio(): app opened audio bytespersample 2 freq 22050 channels 2 bufsize 4096
I/dosbox ( 1946): command:AUTOEXEC.BAT
I/dosbox ( 1946): external command:AUTOEXEC.BAT
I/dosbox ( 1946): command fullname:AUTOEXEC.BAT
I/dosbox ( 1946): command:SET
I/dosbox ( 1946): command:mount
I/dosbox ( 1946): external command:mount
I/dosbox ( 1946): command fullname:mount.COM
I/dosbox ( 1946): command:c:
I/dosbox ( 1946): external command:c:
I/libSDL ( 1946): SDL_SetVideoMode(): application requested mode 640x400 OpenGL 0 HW 1
E/libSDL ( 1946): ERROR: Setting the swap interval is not supported
E/libSDL ( 1946): ERROR: Getting the swap interval is not supported
E/libSDL ( 1946): ERROR: GL_GetAttribute not supported
I/ARMAssembler( 1946): generated scanline__00000177:03010144_00008007_00000000 [104 ipp] (126 ins) at [0xa8ac7ab0:0xa8ac7ca8] in 0 ns
I/ARMAssembler( 1946): generated scanline__00000177:03545444_00009007_00000000 [158 ipp] (212 ins) at [0xa8ac7cb0:0xa8ac8000] in 0 ns
I/dosbox ( 1946): command:dir
I/dosbox ( 1946): command:exit
E/libSDL ( 1946): ERROR: Invalid window
I/libSDL ( 1946): quitting...
I/libSDL ( 1946): quit OK
I/AndroidRuntime( 1946): VM exiting with result code 0, cleanup skipped.
I/WindowState( 1133): WIN DEATH: Window{b4035050 u0 org.gemesys.android.dosbox/org.gemesys.android.dosbox.MainActivity}
W/WindowManager( 1133): Force-removing child win Window{b40a9a88 u0 SurfaceView} from container Window{b4035050 u0 org.gemesys.android.dosbox/org.gemesys.android.dosbox.MainActivity}
I/ActivityManager( 1133): Process org.gemesys.android.dosbox (pid 1946) has died.
W/ActivityManager( 1133): Force removing ActivityRecord{b3ff0968 u0 org.gemesys.android.dosbox/.MainActivity t4}: app died, no saved state
------------- end of first logcat section, where the app runs OK. ---------------
--------------------------------------------------------------------------------------------------------------
2nd Output of "logcat", from Android Emulator, *WITH* checkJNI error checking enabled.
This appears to match the logcat results from my physical Android tablet, a "Digital2", running Android 4.1.1
[The App now crashes the "Dalvik VM", no visible output appears,says bad pointer... ]
--------------------------------------------------------------------------------------------------------------
I/ActivityManager( 1991): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.gemesys.android.dosbox/.MainActivity} from pid 2149
E/SoundPool( 1991): error loading /system/media/audio/ui/KeypressInvalid.ogg
W/AudioService( 1991): Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg
W/AudioService( 1991): onLoadSoundEffects(), Error -1 while loading samples
D/gralloc ( 1972): Registering a buffer in the process that created it. This may cause memory ordering problems.
E/libEGL ( 1972): called unimplemented OpenGL ES API
E/SurfaceFlinger( 1972): glCheckFramebufferStatusOES error 315705578
E/SurfaceFlinger( 1972): got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot
E/libEGL ( 1972): called unimplemented OpenGL ES API
W/WindowManager( 1991): Screenshot failure taking screenshot for (343x201) to layer 21005
I/Choreographer( 2149): Skipped 67 frames! The application may be doing too much work on its main thread.
W/ActivityManager( 1991): Activity pause timeout for ActivityRecord{b3f96040 u0 com.android.launcher/com.android.launcher2.Launcher t1}
I/ActivityManager( 1991): Start proc org.gemesys.android.dosbox for activity org.gemesys.android.dosbox/.MainActivity: pid=2482 uid=10052 gids={50052, 3003, 1028, 1015}
D/dalvikvm( 2482): Not late-enabling CheckJNI (already on)
I/dalvikvm( 2482): CheckJNI enabled: not enabling JNI app bug workarounds.
D/dalvikvm( 1991): GC_CONCURRENT freed 746K, 18% free 6154K/7500K, paused 110ms+39ms, total 669ms
D/CountryDetector( 1991): The first listener is added
V/PhoneStatusBar( 2043): setLightsOn(true)
I/ARMAssembler( 1972): generated scanline__00000077:03515104_00009002_00000000 [127 ipp] (149 ins) at [0xb5bed680:0xb5bed8d4] in 0 ns
I/Choreographer( 2043): Skipped 33 frames! The application may be doing too much work on its main thread.
I/ARMAssembler( 1972): generated scanline__00000077:03010104_00008002_00000000 [ 89 ipp] (110 ins) at [0xb5bed8e0:0xb5beda98] in 0 ns
D/dalvikvm( 2482): Added shared lib /data/app-lib/org.gemesys.android.dosbox-1/libsdl-1.2.so 0xb3d06d70
D/dalvikvm( 2482): Added shared lib /data/app-lib/org.gemesys.android.dosbox-1/libsdl_mixer.so 0xb3d06d70
D/dalvikvm( 2482): No JNI_OnLoad found in /data/app-lib/org.gemesys.android.dosbox-1/libsdl_mixer.so 0xb3d06d70, skipping init
D/dalvikvm( 2482): Added shared lib /data/app-lib/org.gemesys.android.dosbox-1/libsdl_net.so 0xb3d06d70
D/dalvikvm( 2482): Added shared lib /data/app-lib/org.gemesys.android.dosbox-1/libsdl_sound.so 0xb3d06d70
D/dalvikvm( 2482): No JNI_OnLoad found in /data/app-lib/org.gemesys.android.dosbox-1/libsdl_sound.so 0xb3d06d70, skipping init
I/System.out( 2482): libSDL: Settings.Load(): enter
V/MmsConfig( 2465): mnc/mcc: 310260
V/MmsConfig( 2465): tag: bool value: enabledMMS - true
V/MmsConfig( 2465): tag: int value: maxMessageSize - 307200
V/MmsConfig( 2465): tag: int value: maxImageHeight - 480
V/MmsConfig( 2465): tag: int value: maxImageWidth - 640
V/MmsConfig( 2465): tag: int value: defaultSMSMessagesPerThread - 10000
V/MmsConfig( 2465): tag: int value: defaultMMSMessagesPerThread - 1000
V/MmsConfig( 2465): tag: int value: minMessageCountPerThread - 10
V/MmsConfig( 2465): tag: int value: maxMessageCountPerThread - 5000
V/MmsConfig( 2465): tag: string value: uaProfUrl - http://www.google.com/oha/rdf/ua-profile-kila.xml
V/MmsConfig( 2465): tag: int value: recipientLimit - -1
V/MmsConfig( 2465): tag: bool value: enableMultipartSMS - true
V/MmsConfig( 2465): tag: int value: smsToMmsTextThreshold - -1
V/MmsConfig( 2465): tag: bool value: enableSlideDuration - true
V/MmsConfig( 2465): tag: int value: maxMessageTextSize - -1
I/System.out( 2482): libSDL: Settings.Load(): loaded settings successfully
V/SDL ( 2482): GLSurfaceView_SDL::onResume()
I/System.out( 2482): libSDL: DemoGLSurfaceView.onResume(): mRenderer.mGlSurfaceCreated false mRenderer.mPaused false
D/dalvikvm( 2482): GC_CONCURRENT freed 302K, 12% free 2819K/3192K, paused 16ms+10ms, total 460ms
V/SDL ( 2482): GLSurfaceView_SDL::EglHelper::start(): creating GL context
I/Choreographer( 2482): Skipped 65 frames! The application may be doing too much work on its main thread.
V/SDL ( 2482): GLSurfaceView_SDL::EglHelper::createSurface(): creating GL context
D/gralloc_goldfish( 2482): Emulator without GPU emulation detected.
I/System.out( 2482): libSDL: DemoRenderer.onSurfaceCreated(): paused false mFirstTimeStart true
I/libSDL ( 2482): Physical screen resolution is 1024x552, virtual screen 1024x552
D/dalvikvm( 2482): Added shared lib /data/app-lib/org.gemesys.android.dosbox-1/libapplication.so 0xb3d06d70
D/dalvikvm( 2482): No JNI_OnLoad found in /data/app-lib/org.gemesys.android.dosbox-1/libapplication.so 0xb3d06d70, skipping init
D/dalvikvm( 2482): Added shared lib /data/app-lib/org.gemesys.android.dosbox-1/libsdl_main.so 0xb3d06d70
D/dalvikvm( 2482): No JNI_OnLoad found in /data/app-lib/org.gemesys.android.dosbox-1/libsdl_main.so 0xb3d06d70, skipping init
D/dalvikvm( 2482): GC_FOR_ALLOC freed 75K, 17% free 3002K/3588K, paused 43ms, total 43ms
D/MobileDataStateTracker( 1991): default: setEnableFailFastMobileData(enabled=0)
D/dalvikvm( 2482): GC_FOR_ALLOC freed 169K, 16% free 3018K/3588K, paused 72ms, total 72ms
D/dalvikvm( 2482): GC_FOR_ALLOC freed 95K, 16% free 3022K/3588K, paused 42ms, total 42ms
I/ActivityManager( 1991): Displayed org.gemesys.android.dosbox/.MainActivity: +6s92ms
D/dalvikvm( 2482): GC_FOR_ALLOC freed 124K, 18% free 3052K/3700K, paused 273ms, total 273ms
I/dalvikvm-heap( 2482): Grow heap (frag case) to 3.179MB for 140576-byte allocation
D/ConnectivityService( 1991): stopUsingNetworkFeature: teardown net 0: enableHIPRI
I/System.out( 2482): libSDL: setting envvar LANGUAGE to 'en_US'
I/System.out( 2482): libSDL: accelerometer start required: false
D/MobileDataStateTracker( 1991): hipri: Broadcast received: android.intent.action.ANY_DATA_STATE apnType=hipri
I/System.out( 2482): [MCL Debug]: DemoRenderer calling nativeInit with: Glbl.Datadir=> /data/data/org.gemesys.android.dosbox/files and Glbls.CmdLine => dosbox -conf /data/data/org.gemesys.android.dosbox/files/.dosbox/dosbox-0.74.conf Vidcode=> 0
I/libSDL ( 2482): Changing curdir to "/data/data/org.gemesys.android.dosbox/files"
I/libSDL ( 2482): Calling SDL_main("dosbox -conf /data/data/org.gemesys.android.dosbox/files/.dosbox/dosbox-0.74.conf")
I/libSDL ( 2482): param 0 = "dosbox"
I/libSDL ( 2482): param 1 = "-conf"
I/libSDL ( 2482): param 2 = "/data/data/org.gemesys.android.dosbox/files/.dosbox/dosbox-0.74.conf"
D/MobileDataStateTracker( 1991): hipri: Received state=DISCONNECTED, old=CONNECTED, reason=dataDisabled
D/MobileDataStateTracker( 1991): hipri: setDetailed state, old =CONNECTED and new state=DISCONNECTED
D/ConnectivityService( 1991): ConnectivityChange for mobile_hipri: DISCONNECTED/DISCONNECTED
E/logwrapper( 2506): executing /system/bin/ip failed: No such file or directory
E/SecondaryTablController( 48): ip route del failed: /system/bin/ip route del 10.0.2.2/32 via 0.0.0.0 dev eth0 table 60
W/FrameworkListener( 48): Handler 'interface' error (No such device)
I/dosbox ( 2482): conf read:/data/data/org.gemesys.android.dosbox/files/.dosbox/dosbox-0.74.conf
E/logwrapper( 2508): executing /system/bin/ip failed: No such file or directory
E/SecondaryTablController( 48): ip route del failed: /system/bin/ip route del 0.0.0.0/0 via 10.0.2.2 dev eth0 table 60
W/FrameworkListener( 48): Handler 'interface' error (No such device)
I/libSDL ( 2482): SDL_SetVideoMode(): application requested mode 640x400 OpenGL 0 HW 0
E/libSDL ( 2482): ERROR: Setting the swap interval is not supported
E/libSDL ( 2482): ERROR: Getting the swap interval is not supported
E/libSDL ( 2482): ERROR: GL_GetAttribute not supported
D/Nat464Xlat( 1991): requiresClat: netType=5, hasIPv4Address=true
D/MobileDataStateTracker( 1991): default: setPolicyDataEnable(enabled=true)
I/ARMAssembler( 2482): generated scanline__00000177:03010104_00008004_00000000 [100 ipp] (122 ins) at [0xa8b4a1f0:0xa8b4a3d8] in 20000000 ns
I/ARMAssembler( 2482): generated scanline__00000177:03545404_00009007_00000000 [144 ipp] (167 ins) at [0xa8b4a3e0:0xa8b4a67c] in 0 ns
I/ARMAssembler( 2482): generated scanline__00000177:03545404_00009006_00000000 [ 83 ipp] (106 ins) at [0xa8b4a680:0xa8b4a828] in 10000000 ns
E/dalvikvm( 2482): JNI ERROR (app bug): attempt to use stale local reference 0x20300001
W/dalvikvm( 2482): JNI WARNING: 0x20300001 is not a valid JNI reference (CallIntMethod)
W/dalvikvm( 2482): in Lorg/gemesys/android/dosbox/DemoRenderer;.nativeInit:(Ljava/lang/String;Ljava/lang/String;I)V (CallIntMethod)
I/dalvikvm( 2482): "GLThread" prio=5 tid=11 RUNNABLE
I/dalvikvm( 2482): | group="main" sCount=0 dsCount=0 obj=0xb3d5ebd8 self=0xb807fd30
I/dalvikvm( 2482): | sysTid=2502 nice=0 sched=0/0 cgrp=apps handle=-1207434872
I/dalvikvm( 2482): | state=R schedstat=( 1720000000 2570000000 459 ) utm=159 stm=13 core=0
I/dalvikvm( 2482): at org.gemesys.android.dosbox.DemoRenderer.nativeInit(Native Method)
I/dalvikvm( 2482): at org.gemesys.android.dosbox.DemoRenderer.onDrawFrame(Video.java:230)
I/dalvikvm( 2482): at org.gemesys.android.dosbox.GLSurfaceView_SDL$GLThread.run(GLSurfaceView_SDL.java:946)
I/dalvikvm( 2482):
E/dalvikvm( 2482): VM aborting
F/libc ( 2482): Fatal signal 6 (SIGABRT) at 0x000009b2 (code=-6), thread 2502 (GLThread)
I/DEBUG ( 49): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 49): Build fingerprint: 'generic/sdk/generic:4.4.2/KK/938007:eng/test-keys'
I/DEBUG ( 49): Revision: '0'
I/DEBUG ( 49): pid: 2482, tid: 2502, name: GLThread >>> org.gemesys.android.dosbox <<<
I/DEBUG ( 49): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
E/NetdConnector( 1991): NDC Command {57 bandwidth gettetherstats} took too long (741ms)
D/Mms:app ( 2465): cancelNotification
I/DEBUG ( 49): r0 00000000 r1 000009c6 r2 00000006 r3 00000000
I/DEBUG ( 49): r4 00000006 r5 00000016 r6 000009c6 r7 0000010c
I/DEBUG ( 49): r8 b5ad480c r9 b5ad560f sl b5af51f0 fp b5ad57cb
I/DEBUG ( 49): ip b5ad5603 sp ab6a1230 lr b6ed3ead pc b6ee2e20 cpsr 00000010
I/DEBUG ( 49): d0 3f7f128d00002100 d1 3f8000003f800000
I/DEBUG ( 49): d2 3f8000003f800000 d3 bf8000003a800000
I/DEBUG ( 49): d4 bf8000003f800000 d5 3b0000003f800000
I/DEBUG ( 49): scr 60000010
I/DEBUG ( 49):
I/DEBUG ( 49): backtrace:
I/DEBUG ( 49): #00 pc 00021e20 /system/lib/libc.so (tgkill+12)
I/DEBUG ( 49): #01 pc 00012ea9 /system/lib/libc.so (pthread_kill+48)
I/DEBUG ( 49): #02 pc 000130bd /system/lib/libc.so (raise+10)
I/DEBUG ( 49): #03 pc 00011df3 /system/lib/libc.so
I/DEBUG ( 49): #04 pc 000216d4 /system/lib/libc.so (abort+4)
I/DEBUG ( 49): #05 pc 00045be7 /system/lib/libdvm.so (dvmAbort+78)
I/DEBUG ( 49): #06 pc 00038b1b /system/lib/libdvm.so
I/DEBUG ( 49): #07 pc 000399e7 /system/lib/libdvm.so
I/DEBUG ( 49): #08 pc 000402af /system/lib/libdvm.so
I/DEBUG ( 49): #09 pc 00026d55 /data/app-lib/org.gemesys.android.dosbox-1/libsdl-1.2.so (SDL_ANDROID_CallJavaSwapBuffers+180)
I/DEBUG ( 49): #10 pc 00025d67 /data/app-lib/org.gemesys.android.dosbox-1/libsdl-1.2.so
I/DEBUG ( 49): #11 pc 0001ff25 /data/app-lib/org.gemesys.android.dosbox-1/libsdl-1.2.so (SDL_Flip+224)
I/DEBUG ( 49): #12 pc 0015dda5 /data/app-lib/org.gemesys.android.dosbox-1/libapplication.so
I/DEBUG ( 49):
D/Tethering( 1991): MasterInitialState.processMessage what=
E/NativeCrashListener( 1991): at com.android.server.am.NativeCrashListener.run(NativeCrashListener.java:138)
E/NetdConnector( 1991): NDC Command {59 bandwidth removeiquota eth0} took too long (1555ms)
I/BootReceiver( 1991): Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE)
I/ActivityManager( 1991): Process org.gemesys.android.dosbox (pid 2482) has died.
I/WindowState( 1991): WIN DEATH: Window{b4097048 u0 org.gemesys.android.dosbox/org.gemesys.android.dosbox.MainActivity}
D/Zygote ( 1973): Process 2482 terminated by signal (6)
W/WindowManager( 1991): Force-removing child win Window{b4099b68 u0 SurfaceView} from container Window{b4097048 u0 org.gemesys.android.dosbox/org.gemesys.android.dosbox.MainActivity}
W/ActivityManager( 1991): Force removing ActivityRecord{b4035dd0 u0 org.gemesys.android.dosbox/.MainActivity t2}: app died, no saved state
-------- end of first second sample, where app crashes and dies. ------------------------------------------------------------------------------------------
---------- note "dalvik" reporting that say:
--------------> D/dalvikvm( 2482): Not late-enabling CheckJNI (already on)
--------------> I/dalvikvm( 2482): CheckJNI enabled: not enabling JNI app bug workarounds
-------- Any for app to enable "JNI app bug workarounds", that "dalvik"has turned off ???
-------- So far, the current answer is simply: "No." ------------------------------------------------------------------------------------------
代码:
/**
* A generic GL Thread. Takes care of initializing EGL and GL. Delegates to
* a Renderer instance to do the actual drawing. Can be configured to render
* continuously or on request.
*
*/
class GLThread extends Thread implements SwapBuffersCallback {
GLThread(Renderer renderer) {
super();
mDone = false;
mWidth = 0;
mHeight = 0;
mRequestRender = true;
mRenderMode = RENDERMODE_CONTINUOUSLY;
mRenderer = renderer;
mRenderer.setSwapBuffersCallback(this);
setName("GLThread");
}
@Override
public void run() {
/*
* When the android framework launches a second instance of an
* activity, the new instance's onCreate() method may be called
* before the first instance returns from onDestroy().
*
* This semaphore ensures that only one instance at a time accesses
* EGL.
*/
try {
sEglSemaphore.acquire();
} catch (InterruptedException e) {
return;
}
mEglHelper = new EglHelper();
// mEglHelper.start();
mNeedStart = true;
mSizeChanged = true;
SwapBuffers();
mRenderer.onDrawFrame(mGL); /* <---------------- fails here, I think */
mEglHelper.finish();
/*
* synchronized (sGLThreadManager) { stopEglLocked(); }
* sGLThreadManager.threadExiting(this);
*/
sEglSemaphore.release();
}
public boolean SwapBuffers() {
boolean tellRendererSurfaceCreated = false;
boolean tellRendererSurfaceChanged = false;
/*
* This is our main activity thread's loop, we go until asked to
* quit.
*/
try {
/*
* Update the asynchronous state (window size)
*/
while (true) { // Loop until we're re-created GL context and
// successfully called swap()
int w, h;
boolean changed = false;
synchronized (this) {
if (mPaused) {
mRenderer.onSurfaceDestroyed();
mEglHelper.finish();
mNeedStart = true;
if (Globals.NonBlockingSwapBuffers)
return false;
}
while (needToWait()) {
// Log.v("SDL", "GLSurfaceView_SDL::run(): paused");
wait();
}
if (mDone) {
return false;
}
// changed = mSizeChanged;
w = mWidth;
h = mHeight;
mSizeChanged = false;
mRequestRender = false;
}
if (mNeedStart) {
mEglHelper.start();
tellRendererSurfaceCreated = true;
changed = true;
mNeedStart = false;
}
if (changed) {
/* MCL note. This is where mGL is set */
mGL = (GL10) mEglHelper.createSurface(getHolder());
tellRendererSurfaceChanged = true;
}
if (tellRendererSurfaceCreated) {
mRenderer.onSurfaceCreated(mGL, mEglHelper.mEglConfig);
tellRendererSurfaceCreated = false;
}
if (tellRendererSurfaceChanged) {
mRenderer.onSurfaceChanged(mGL, w, h);
tellRendererSurfaceChanged = false;
}
/*
* Once we're done with GL, we need to call swapBuffers() to
* instruct the system to display the rendered frame
*/
if (mEglHelper.swap())
return true;
// We've lost GL context - recreate it
mRenderer.onSurfaceDestroyed();
mEglHelper.finish();
mNeedStart = true;
if (Globals.NonBlockingSwapBuffers)
return false;
}
} catch (java.lang.InterruptedException e) {
return false;
}
}
private boolean needToWait() {
if (mDone) {
return false;
}
if (mPaused || (!mHasSurface)) {
return true;
}
if ((mWidth > 0)
&& (mHeight > 0)
&& (mRequestRender || (mRenderMode == RENDERMODE_CONTINUOUSLY))) {
return false;
}
return true;
}
public void setRenderMode(int renderMode) {
if (!((RENDERMODE_WHEN_DIRTY <= renderMode) && (renderMode <= RENDERMODE_CONTINUOUSLY))) {
throw new IllegalArgumentException("renderMode");
}
synchronized (this) {
mRenderMode = renderMode;
if (renderMode == RENDERMODE_CONTINUOUSLY) {
notify();
}
}
}
public int getRenderMode() {
synchronized (this) {
return mRenderMode;
}
}
public void requestRender() {
synchronized (this) {
mRequestRender = true;
notify();
}
}
public void surfaceCreated() {
synchronized (this) {
mHasSurface = true;
notify();
}
}
public void surfaceDestroyed() {
synchronized (this) {
mHasSurface = false;
notify();
}
}
public void requestExitAndWait() {
// don't call this from GLThread thread or it is a guaranteed
// deadlock!
synchronized (this) {
mDone = true;
notify();
}
try {
join();
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
/**
* Queue an "event" to be run on the GL rendering thread.
*
* @param r
* the runnable to be run on the GL rendering thread.
*/
public void queueEvent(Runnable r) {
synchronized (this) {
mEventQueue.add(r);
}
}
@SuppressWarnings("unused")
private Runnable getEvent() {
synchronized (this) {
if (mEventQueue.size() > 0) {
return mEventQueue.remove(0);
}
}
return null;
}
private boolean mDone;
private boolean mPaused;
private boolean mHasSurface;
private int mWidth;
private int mHeight;
private int mRenderMode;
private boolean mRequestRender;
private Renderer mRenderer;
private ArrayList<Runnable> mEventQueue = new ArrayList<Runnable>();
private EglHelper mEglHelper;
private GL10 mGL = null;
private boolean mNeedStart = false;
}
- 代码结束 -