Android应用程序在某些机型上启动有几率一直黑屏


====================问题描述====================
我们使用Mono for Android开发了一个App,发现在某些机型上(比如lenovo A3000-H)会打开会出现一直黑屏的情况,进不到程序的界面(同样也定位不到任何调试断点),而有些机型则不会。

通过仔细观察,发现在后台“当前运行程序”一栏,当成功启动时,程序所占体积是21mb左右。当启动失败时(一直黑屏),程序所占体积是9mb左右。

另外通过eclipse监控程序启动日志,对比发现了一些不同。

成功启动时的日志
02-24 16:00:47.038: I/ActivityManager(515): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.GDSCP.ModileEnforces/mobileenforces.BeginActivity} from pid 1016
02-24 16:00:47.073: W/Trace(515):   
02-24 16:00:47.078: I/BufferQueue(133): [unnamed-133-2248](this:0x41f5b448,api:0) BufferQueue
02-24 16:00:47.078: I/BufferQueue(133): [unnamed-133-2248](this:0x41f5b448,api:0) consumerConnect
02-24 16:00:47.078: I/BufferQueue(133): [unnamed-133-2248](this:0x41f5b448,api:0) setConsumerName: unnamed-133-2248
02-24 16:00:47.078: I/SurfaceTexture(133): [unnamed-133-2248](this:0x41f5e5e8,api:0) SurfaceTexture
02-24 16:00:47.078: I/BufferQueue(133): [unnamed-133-2248](this:0x41f5b448,api:0) setSynchronousMode: enabled=1
02-24 16:00:47.078: I/BufferQueue(133): [unnamed-133-2248](this:0x41f5b448,api:0) setDefaultBufferSize: w=1, h=1
02-24 16:00:47.078: I/BufferQueue(133): [Starting com.GDSCP.ModileEnforces](this:0x41f5b448,api:0) setConsumerName: Starting com.GDSCP.ModileEnforces
02-24 16:00:47.080: W/Trace(515):   

02-24 16:00:47.085: I/BufferQueue(133): [Starting com.GDSCP.ModileEnforces](this:0x41f5b448,api:0) setDefaultBufferSize: w=1024, h=552
02-24 16:00:47.088: W/Trace(515):   

02-24 16:00:47.093: E/Launcher(1016): new onSaveInstanceState <F2><F2><F2><F2><F2><F2><F2><F2><F2><F2><F2><F2><F2><F2>
02-24 16:00:47.094: E/Launcher(1016): onPause flag orientation falg        =2
02-24 16:00:47.097: W/Trace(515):   

  
02-24 16:00:47.109: I/BufferQueue(133): [Starting com.GDSCP.ModileEnforces](this:0x41f5b448,api:0) connect: api=2

02-24 16:00:47.109: I/BufferQueue(133): [Starting com.GDSCP.ModileEnforces](this:0x41f5b448,api:2) setSynchronousMode: enabled=1

02-24 16:00:47.109: I/BufferQueue(133): [Starting com.GDSCP.ModileEnforces](this:0x41f5b448,api:2) new GraphicBuffer needed

02-24 16:00:47.113: I/GraphicBuffer(133): allocate buffer (w:1024 h:552 f:1) err(0)


02-24 16:00:47.115: I/ActivityManager(515): Start proc com.GDSCP.ModileEnforces for activity com.GDSCP.ModileEnforces/mobileenforces.BeginActivity: pid=2225 uid=10106 gids={50106, 3003, 1015, 1028}
02-24 16:00:47.117: W/Trace(515):   


02-24 16:00:47.117: W/Trace(515):   
02-24 16:00:47.118: I/BufferQueue(133):     [NEW] gb=0x41f63690, handle=0x41f63090, w=1024, h=552, s=1024, fmt=1
02-24 16:00:47.125: W/Trace(515):   
02-24 16:00:47.135: I/SurfaceTexture(133): [Starting com.GDSCP.ModileEnforces](this:0x41f5e5e8,api:2) [void* android::SurfaceTexture::createImage(EGLDisplay, const android::sp<android::GraphicBuffer>&)]
02-24 16:00:47.138: W/Trace(1016):   ///////////////////////
02-24 16:00:47.150: I/com.umeng.common.b(1016): Could not get location from GPS or Cell-id, lack ACCESS_COARSE_LOCATION or ACCESS_COARSE_LOCATION permission?
02-24 16:00:47.160: W/Trace(2225):   
02-24 16:00:47.160: W/Trace(2225):   
02-24 16:00:47.167: W/ADB_SERVICES(2431): create_local_service_socket() name=jdwp:2225
02-24 16:00:47.168: W/ADB_SERVICES(2431): looking for pid 2225 in JDWP process list return fds0(18) fds1(20)
02-24 16:00:47.168: W/ADB_SERVICES(2431): trying to write to JDWP socket=16 pid=2225 count=1 out_fds=20
02-24 16:00:47.182: W/Trace(515):   
02-24 16:00:47.184: W/Trace(515):   
02-24 16:00:47.184: I/WindowManager(515): Losing focus: Window{41b51e38 u0 com.lenovo.launcher/com.lenovo.launcher2.Launcher}
02-24 16:00:47.184: W/Trace(515):   
02-24 16:00:47.205: W/Trace(515):   
02-24 16:00:47.214: I/ActivityThread(2225): Pub com.GDSCP.ModileEnforces.mono.MonoRuntimeProvider.__mono_init__: mono.MonoRuntimeProvider
02-24 16:00:47.218: W/MonoDroid-Debugger(2225): Not starting the debugger as the timeout value has been reached; current-time: 1393228847  timeout: 1392886499
02-24 16:00:47.227: E/mono(2225): WARNING: The runtime version supported by this application is unavailable.
02-24 16:00:47.229: E/mono(2225): Using default runtime: v2.0.50727
02-24 16:00:47.242: I/SurfaceTextureClient(133): [STC::queueBuffer] (this:0x41ad6840) fps:0.19, dur:69222.88, max:69032.22, min:5.73
02-24 16:00:47.242: I/SurfaceTextureClient(133): [STC::queueBuffer] this:0x41ad6840, api:1, last queue time elapsed:69032.22
02-24 16:00:47.242: I/BufferQueue(133): [FramebufferSurface](this:0x41ad9008,api:1) [release] fps:0.19, dur:69222.92, max:69032.27, min:5.69
02-24 16:00:47.242: I/BufferQueue(133): [FramebufferSurface](this:0x41ad9008,api:1) [queue] fps:0.19, dur:69222.87, max:69032.27, min:5.61
02-24 16:00:47.250: W/libc(2225): WARNING: generic atexit() called from legacy shared library
02-24 16:00:47.263: W/monodroid-gc(2225): GREF GC Threshold: 46800
02-24 16:00:47.521: W/Trace(515):   
02-24 16:00:47.531: W/Trace(515):   
02-24 16:00:47.618: I/AppCheck(3425): oldcom.lenovo.launcher------------new:com.GDSCP.ModileEnforces
02-24 16:00:47.618: I/AppCheck(3425): runningTask------------action:com.lenovo.safecenter.activityswitch com.GDSCP.ModileEnforces com.lenovo.launcher
02-24 16:00:47.621: W/Trace(3425):   
02-24 16:00:47.621: I/LeemCenterReceiver(3425): onReceive()
02-24 16:00:47.622: I/AppCheck(3425): runningTask------------end
02-24 16:00:47.623: I/AppCheck(3425): recentTask------------action:com.lenovo.safecenter.activityswitch2 com.GDSCP.ModileEnforces com.lenovo.launcher
02-24 16:00:47.625: I/AppCheck(3425): recentTask------------end
02-24 16:00:47.626: I/LeemCenterReceiver(3425): newPkg interval == 1393228847625
02-24 16:00:47.626: I/LeemCenterReceiver(3425): cur == 1393228847626 bootTime == 0 time == 1393228847625
02-24 16:00:47.628: W/Trace(3425):   
02-24 16:00:47.628: W/Trace(3425):   
02-24 16:00:47.628: I/ydp(3425): pkg---->com.GDSCP.ModileEnforces
02-24 16:00:47.628: E/ydp(3425): checkApp pkgName:com.GDSCP.ModileEnforces
02-24 16:00:47.640: I/safepaymen(3425): clearNotify Pkg:com.lenovo.launcher
02-24 16:00:47.647: W/Trace(3425):   
02-24 16:00:47.647: W/Trace(3425):   
02-24 16:00:47.649: W/Trace(3425):   ////启动失败的顺序排位不同了
//先创建实例,再启动。而启动失败,则是先启动,再创建实例。
02-24 16:00:47.671: E/Launcher(1016): onTriMM<F2><F2><F2><F2><F2><F2><F2><F2><F2><F2><F2><F2><F2>
02-24 16:00:47.671: E/AppsCustomizeTabHost(1016): onTrimMemory reset       000000000000000000000097777766666666111111 
02-24 16:00:47.697: W/Parcel(515): Attempt to read object from Parcel 0x57357554 at offset 68 that is not in the object list
02-24 16:00:47.810: I/BufferQueue(133): [com.lenovo.launcher/com.lenovo.launcher2.Launcher](this:0x41f68008,api:1) disconnect: api=1
02-24 16:00:47.810: I/SurfaceTexture(133): [com.lenovo.launcher/com.lenovo.launcher2.Launcher] [virtual android::status_t android::SurfaceTexture::forceAuxConversionLocked()] mCurrentTexture:1, mCurrentBuf:0x41f874f8
02-24 16:00:47.810: I/BufferQueue(133): [com.lenovo.launcher/com.lenovo.launcher2.Launcher](this:0x41f68008,api:0) getReleasedBuffers: returning mask 0xffffffff
02-24 16:00:47.810: I/SurfaceTexture(133): [com.lenovo.launcher/com.lenovo.launcher2.Launcher](this:0x41e38b58,api:0) destroying EGLImage dpy=0x1 img=0x41e38950
02-24 16:00:47.811: I/SurfaceTexture(133): [com.lenovo.launcher/com.lenovo.launcher2.Launcher](this:0x41e38b58,api:0) destroying EGLImage dpy=0x1 img=0x4203c270
02-24 16:00:47.811: I/SurfaceTexture(133): [com.lenovo.launcher/com.lenovo.launcher2.Launcher](this:0x41e38b58,api:0) destroying EGLImage dpy=0x1 img=0x41f877b8
02-24 16:00:47.812: I/SurfaceTexture(133): [com.lenovo.launcher/com.lenovo.launcher2.Launcher](this:0x41e38b58,api:0) destroying EGLImage dpy=0x1 img=0x41f7cab8
02-24 16:00:47.818: I/mono-stdout(2225):  
02-24 16:00:47.836: I/mono-stdout(2225):  16:00:47 | info | >>>Initialize the database>>>> 02-24 16:00:47.836: I/mono-stdout(2225):  //启动成功了调用对应的输出
......其后略

启动失败时的日志贴在2L
====================解决方案1====================
别费时间,用c#开发安卓是自己和自己过不去
====================解决方案2====================
我咋看到这么多ERROR。。

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。