打包apk黑屏什么情况?

pt.AppActivity t22969} time:60986646
02-09 19:22:49.397 24498 24512 D cocos2d-x debug info: Cocos2d-JS v3.13
02-09 19:22:49.677 24498 24512 D cocos2d-x: create rendererRecreatedListener for GLProgramState
02-09 19:22:49.677 24498 24512 D cocos2d-x: cocos2d: QuadCommand: resizing index size from [-1] to [2560]
02-09 19:22:49.857 24498 24512 D cocos2d-x debug info: Success to load scene: db://assets/Scene/menu.fire
02-09 19:22:49.887 24498 24512 D cocos2d-x debug info: Open
02-09 19:22:49.927 24498 24512 D cocos2d-x debug info: preloadScene(load) over

从日志上看应该加载成功了呀,之前有js错误我都修复了,现在没错误,又黑屏,左下角的debug信息GL calls那些可以正常显示

需要更详细的 log 信息才能判断问题原因!

那我贴一个完整的:

02-10 11:19:34.555  3569  4228 D PackageManager: getComponentMetadataForIconTray : org.cocos2dx.javascript.AppActivity does not exist in mServices
02-10 11:19:34.555  3569  4228 D PackageManager: getComponentMetadataForIconTray : org.cocos2dx.javascript.AppActivity does not exist in mProviders
02-10 11:19:34.555  3569  4228 D PackageManager: getComponentMetadataForIconTray : org.cocos2dx.javascript.AppActivity does not exist in mReceivers
02-10 11:19:34.645  3031  3031 V ActivityThread: updateVisibility : ActivityRecord{76d461e token=android.os.BinderProxy@f5a971a {com.sxxxd.BxgDl/org.cocos2dx.javascript.AppActivity}} show : false
02-10 11:19:36.515  3569  5706 V WindowManager: addAppToken: AppWindowToken{3adba86 token=Token{9113f61 ActivityRecord{8cb2c8 u0 com.sxxxd.BxgDl/org.cocos2dx.javascript.AppActivity t22987}}} to stack=1 task=22987 at 0
02-10 11:19:36.535  3569  5780 I ActivityManager: Start proc 3920:com.sxxxd.BxgDl/u0a948 for activity com.sxxxd.BxgDl/org.cocos2dx.javascript.AppActivity
02-10 11:19:36.615  3920  3920 D main    : cocos_android_app_init
02-10 11:19:36.615  3920  3920 D Java_org_cocos2dx_lib_Cocos2dxHelper.cpp: nativeSetAudioDeviceInfo: sampleRate: 48000, bufferSizeInFrames: 960
02-10 11:19:36.665  3920  3920 I InjectionManager: dispatchOnViewCreated > Target : org.cocos2dx.javascript.AppActivity isFragment :false
02-10 11:19:36.665  3569  5780 D ISSUE_DEBUG: InputChannelName : 3f87d0c com.sxxxd.BxgDl/org.cocos2dx.javascript.AppActivity
02-10 11:19:36.695  3569  3654 D StatusBarManagerService: manageDisableList userId=0 what=0x0 pkg=Window{3f87d0c u0 d0 com.sxxxd.BxgDl/org.cocos2dx.javascript.AppActivity}
02-10 11:19:36.745  3920  3935 D cocos2d-x:
02-10 11:19:36.745  3920  3935 D cocos2d-x: {
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	gl.supports_OES_packed_depth_stencil: true
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	gl.supports_vertex_array_object: true
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	gl.supports_BGRA8888: false
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	cocos2d.x.version: 1.3.3-lite
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	gl.supports_discard_framebuffer: true
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	cocos2d.x.compiled_with_profiler: false
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	gl.supports_PVRTC: false
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	cocos2d.x.build_type: DEBUG
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	gl.renderer: Mali-T760
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	gl.supports_OES_depth24: true
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	gl.supports_ETC1: true
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	gl.supports_OES_map_buffer: true
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	cocos2d.x.compiled_with_gl_state_cache: true
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	gl.version: OpenGL ES 3.1 v1.r7p0-03rel0.b596bd02e7d0169c10574b57180c8b57
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	gl.supports_NPOT: true
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	gl.max_texture_units: 96
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	gl.vendor: ARM
02-10 11:19:36.745  3920  3935 D cocos2d-x: 	gl.max_texture_size: 8192
02-10 11:19:36.745  3920  3935 D cocos2d-x: }
02-10 11:19:36.745  3920  3935 D cocos2d-x:
02-10 11:19:36.745  3920  3935 E cocos2d-x: cocos2d: warning, Director::setProjection() failed because size is 0
02-10 11:19:36.755  3569  5132 V WindowStateAnimator: Finishing drawing window Window{3f87d0c u0 d0 com.sxxxd.BxgDl/org.cocos2dx.javascript.AppActivity}: mDrawState=DRAW_PENDING
02-10 11:19:36.765  3569  3689 I ActivityManager: Displayed com.sxxxd.BxgDl/org.cocos2dx.javascript.AppActivity: +238ms (total +7s35ms)
02-10 11:19:36.765  3920  3935 D cocos2d-x: cocos2d: fullPathForFilename: No file found at script/jsb_prepare.jsc. Possible missing file.
02-10 11:19:36.775  3569  4065 V WindowStateAnimator: Finishing drawing window Window{3f87d0c u0 d0 com.sxxxd.BxgDl/org.cocos2dx.javascript.AppActivity}: mDrawState=HAS_DRAWN
02-10 11:19:36.805  3920  3935 D cocos2d-x: cocos2d: fullPathForFilename: No file found at script/jsb_boot.jsc. Possible missing file.
02-10 11:19:36.815  3920  3935 D cocos2d : android SDK version:23
02-10 11:19:36.955  3569  3689 I Timeline: Timeline: Activity_windows_visible id: ActivityRecord{8cb2c8 u0 com.sxxxd.BxgDl/org.cocos2dx.javascript.AppActivity t22987} time:79352041
02-10 11:19:37.155  3920  3935 D cocos2d-x debug info: Cocos2d-JS v3.13
02-10 11:19:37.425  3920  3935 D cocos2d-x: create rendererRecreatedListener for GLProgramState
02-10 11:19:37.435  3920  3935 D cocos2d-x: cocos2d: QuadCommand: resizing index size from [-1] to [2560]
02-10 11:19:37.605  3920  3935 D cocos2d-x debug info: Success to load scene: db://assets/Scene/menu.fire
02-10 11:19:37.625  3920  3935 D cocos2d-x debug info: Open
02-10 11:19:37.675  3920  3935 D cocos2d-x debug info: preloadScene(load) over

…后面没有 log 了吗?
能不能把 apk 发出来我们调试一下呢?

好的可以,我刚才清空重新build了,比较慢,一会儿编译好了发出来

后面没有了,我看唯一不太正常的就是: cocos2d: warning, Director::setProjection() failed because size is 0

其他没发现什么, 一会儿给你们发apk吧

http://ac-hpmtoewq.clouddn.com/94ae34d33640c606bb38.apk 可以在这里下载

请问下有办法了吗? 我看有3个人下载了…

你这个 apk 是用哪个 API Level 打包的啊?我这边两个设备都无法运行。看起来跟系统版本有关。

找了个 6.0 系统的机器装上可以运行了。看了下 log,你的项目有使用 AnySDK?我看到 log 中有一下 warning 的 log。可能跟黑屏有关。

其他的并没有看到与黑屏相关的 log…:joy:

额,我用的android-21呀, 现在没有用anysdk, 不过准备要用的… 无法运行什么情况…
我这边没有低于6.0的设备要不可以测试下,不过你说的和黑屏有关的log是哪一句?

这下我怎么办…

能不能先把使用 anysdk 的代码注释起来试试看。如果还是黑屏,那就跟 anysdk 没什么关系。需要从工程源码进行分析了。

PS:模拟器预览是正常的吧?

模拟器? 我们一直都是用浏览器调试的,就是web-mobile发布,没问题

anysdk在哪里屏蔽?我看文档说这个是打包自动集成好的? 代码是java还是c++的?

如果你们没有手动添加过 anysdk 相关的东西,那黑屏应该跟 anysdk 没什么关系。

你们都没有用模拟器预览过吗?那可能是代码中使用了 native 不支持的功能导致了黑屏,可以试一下模拟器预览效果是否正确。模拟器预览的功能见下图:

我晕,还真是,模拟器黑屏…

而且日志和我之前发的貌似没什么区别,除了这一行警告就没什么了:
Simulator: cocos2d: warning, Director::setProjection() failed because size is 0

这个 warning 应该并没有什么影响,不会导致黑屏…

那怎么调试…什么错也没有…

前车之鉴,以前我用cocos2dx的时候遇到过,是因为一张图片的名字在代码里打错了,多了一个字母,当时困扰了我一天…,不过好像当时是会报内存错误的,所以试试看检查一下你的资源的引用和名字的大小写是否正确

额,多谢,不过这么多文件你当时是怎么检查的…