Hi all,
I’m having problems for run apps in android emulator. In a real device works but in a emulator not. This is the error log when I’m trying to run the app:
Anyone know what’s the problem? I tried with differents device emulators, but nothing works.
I’m running Android Studio 3.0.1 in iMac (High Sierra)
P.S.: I installed the sdks, ndks, jre, HAXM, etc.
UP.
Someone can run Android Emulator (from Android Studio) in a macOS High Sierra 10.13.3 ? It’s impossible for me, I tried different alternatives but nothing works.
I’ve had the same problem after upgrading to high sierra last year (using a hackintosh though), however with a different opengles error. I narrowed it down pretty quickly to this issue by enabling some opengles debug functions (I don’t remember anymore what I did exactly).
Basically go to cocos2d/cocos/renderer/CCGLProgram.cpp line #149 and add mediump
@domp thanks for your help.
I’ve the same error changing that, however, now I can view the initial scene of my game in the emulator (before this change, the emulator had black screen).
However, then I touch “Play”, the scene is replaced and appears again a black screen in the emulator. I hear the game music, the game is running, but the screen is black.
I read that it’s a Intel HAXM problem with Sierra. I’m not using hackintosh, i’m with a real iMac. I’ve other pc with Windows and the emulators works perfect, and i’ve the same configuration in android studio.
I would like solve it with some configuration, without editing any cpp file from cocos. I think it isn’t a cocos framework problem. @zhangxm ? @slackmoehrle ? Maybe anyone lived it
Alright so your initial scene works now, that’s a start. I’m pretty sure that the game showing a black screen after pressing play is a different error caused by the game itself. You should be able to narrow it down by commenting out bits of code in your play function and whatever nodes you are creating in the new scene.
I’ve had black screens and opengles errors like that a few times, turned out to be some minor mistake like creating a sprite with an invalid texture, or creating a node from a different thread etc.
Nope, my game works fine. I tested it in some real iPhones and in a real Androids devices. Works perfect. The problem is specifically in a Android Emulator running on High Sierra 10.13. Even, as I mentioned before, in a Android Emulator running in Windows, works perfect.
Well, it might work just fine on real devices and on windows, yet you could still have made a mistake somewhere that only the android emulator on mac os complains about. I can only advise you to just try commenting some parts out, at least that’s what I would do. Something you are doing inside your play function or creating in the new scene has to undeniably cause this after all. Unless of course the Director’s replaceScene() function itself is causing the screen to go black.
No, after replaceScene() I continue viewing the screen. However I continue executing step by step and I don’t find in what line the screen transforms in black. Even, I entered to cocos frameworks instructions for debug step by step but I arrive to the file __functional_base.h and I can’t continue debugging step by step.
Is very hard debug it and i’m sure that isn’t my code the problem. Are much the Android real devices that I tested succesfully it.
In addition, the modification that you have proposed is editing a cocos cpp file, and i view some results editing that. That’s a demostration that isn’t my code the problem.
Yes, that’s expected. Debugging by stepping through execution is a good practice in most cases, but not in this one since the renderer will not update when you step through your code but instead inside his own timer outside of your scene creation/play function. You’ll have to resort to removing things manually unfortunately.
Or here’s an even simpler way to verify that your scene is causing the black screen: Create a new bare minimum scene with a label in the middle to verify that everything is working, and replace the initial scene with that one instead. If it still shows a black screen I’ll admit I was completely wrong.
Before the initial menu scene, exist the splash screen in my game. The transition between scene1 and scene2 is automatic.
This is the sequence:
Scene1 -> Splash screen.
Scene2 -> Initial menu.
Scene3 -> After pressing Play button.
With ur modification, scene1 and scene2 works. So, replaceScene isn’t a problem.
Thanks for your help, but I completely discard a problem in my code. Why it works in Android emulator in windows and not in android emulator in Sierra? Both emulators have the same configuration. And my code is the same. Is ilogic. If I the problem is my code, it should fail in both emulators. The problem is the OS.
At this point you could only send me a minimal project that reproduces the black screen and I’ll take a look at it next week, otherwise I can’t assist any further without repeating myself.