Search Unity

[EGL] Unable to create context

Discussion in 'Android' started by neufoctobre, Jun 20, 2015.

  1. neufoctobre

    neufoctobre

    Joined:
    Jun 20, 2015
    Posts:
    94
    Hi everybody,
    First thing I'm a novice about coding, I learn by myself 9 month ago so I'm really not strong ^^.

    I have a game with google analytic installed and I get a lot of error report related to [EGL] like this :

    . [EGL] Unable to create context!: EGL_BAD_CONTEXT: An EGLContext argument does not name a valid EGL rendering context.
    . [EGL] Unable to acquire context: EGL_BAD_NATIVE_WINDOW: A NativeWindowType argument does not refer to a valid native window.
    . [EGL] Unable to acquire context: EGL_BAD_SURFACE: An EGLSurface argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering.
    . [EGL] Unable to find a configuration matching minimum spec!
    . [EGL] Failed to create window surface: EGL_BAD_NATIVE_WINDOW: A NativeWindowType argument does not refer to a valid native window.
    . [EGL] Unable to acquire context: EGL_BAD_ALLOC: EGL failed to allocate resources for the requested operation.
    . [EGL] Failed to create window surface: EGL_BAD_ALLOC: EGL failed to allocate resources for the requested operation.
    . [EGL] Unable to acquire context: EGL_BAD_ACCESS: EGL cannot access a requested resource (for example a context is bound in another thread).
    . [EGL] eglDestroySurface(m_EGLDisplay, m_EGLSurface): EGL_BAD_PARAMETER: One or more argument values are invalid.
    . [EGL] eglDestroySurface(m_EGLDisplay, m_EGLSurface): EGL_BAD_SURFACE: An EGLSurface argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering.
    . [EGL] Unable to release context: EGL_BAD_ALLOC: EGL failed to allocate resources for the requested operation.


    I use Unity 5.0.2 with NGui and some othe plugin (social,ads and unibill).
    I don't even know how to recreate these problem, and of course of to solve them. I just know these problem comes from :


    . Samsung Galaxy Pocket Plus (S5301, GT-S5301L , GT-S5301B, GT-S5303B
    . Samsung Galaxy Tab 3 lite
    . Samsung Galaxy Y Plus
    . and more and more ^^


    I use an automatic compression for all my texture, may be the problem come frome here, should I use ETC instead ?

    Thanks in advance for your patience :)

     
    earthcrosser likes this.
  2. neufoctobre

    neufoctobre

    Joined:
    Jun 20, 2015
    Posts:
    94
    Nobody ?
     
  3. Sam_SmartCityTec

    Sam_SmartCityTec

    Joined:
    Aug 19, 2014
    Posts:
    1
    Same problem as I am facing.
    I have tried to start a new blank project but got the same problem.
    So, the reason should not be related to plugin.
     
  4. neufoctobre

    neufoctobre

    Joined:
    Jun 20, 2015
    Posts:
    94
    Ok thanks, that already help to know this don't come from any plugin ^^.
     
  5. DVFrance

    DVFrance

    Joined:
    Jul 9, 2012
    Posts:
    20
    I only got that one too :
    [EGL] Unable to acquire context: EGL_BAD_NATIVE_WINDOW: A NativeWindow Type argument does not refer to a valid native window.

    Still have no idea from where it could come ???
     
  6. mamoniem

    mamoniem

    Joined:
    Jul 23, 2012
    Posts:
    174
    4.x cloth might be the reason.

    -m
     
  7. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    Getting

    on multiple Android devices, including at least the following:
    Samsung GT-P5100
    Samsung GT-P5110
    Samsung GT-P5210
    Samsung GT-P5220
    Quanta Gigaset QV830

    Judging from the logs, it seems to happen when leaving the app on the background and switching back. Using Unity 5.1.3p2, forced OpenGL ES 2.0. Left a bug report (725668) but couldn't really post a repro.
     
  8. jun-yambao0312

    jun-yambao0312

    Joined:
    Dec 19, 2014
    Posts:
    3
    I also experienced this when using Asus Android phone.
     

    Attached Files:

    jamesjxiao likes this.
  9. poolts

    poolts

    Joined:
    Aug 9, 2012
    Posts:
    113
    I'm also getting:

    [EGL] Unable to acquire context: EGL_BAD_NATIVE_WINDOW: A NativeWindowType argument does not refer to a valid native window.

    Here's a break down of devices it's occurring on and OS's (if it helps).

    Devices.png OS.png
     
  10. jun-yambao0312

    jun-yambao0312

    Joined:
    Dec 19, 2014
    Posts:
    3
    You mean it depends on the brand that i will be using?
     
  11. jorrit-de-vries

    jorrit-de-vries

    Joined:
    Aug 7, 2009
    Posts:
    71
    @jun.yambao0312 No, I don't think it depends on the brand, nor the Android version.

    We also see quite some of these types of errors in our Unity Android projects. I am not sure if this actually causes a crash, or that it is merely an error log and the user's experience is not affected in a (really) bad manner. Maybe a Unity dev/support can elaborate on this, since it pretty much clutters error reporting, but the cause is rather unclear, as is reproducibility.
     
  12. poolts

    poolts

    Joined:
    Aug 9, 2012
    Posts:
    113
    Not entirely sure if it's a certain brand or OS, but I dumped the data, in case there was some sort of pattern. Every little helps! :)
     
  13. NeilW

    NeilW

    Joined:
    May 29, 2014
    Posts:
    40
    We are also seeing a fairly substantial number of these being reported in our crash tracking tool and interestingly they seems to be a lot of overlap with the devices listed by poolts:

    upload_2016-1-5_12-13-27.png
     
    milox777 likes this.
  14. Salazar

    Salazar

    Joined:
    Sep 2, 2013
    Posts:
    235
    Up +1
    E/Unity: [EGL] Unable to acquire context: EGL_BAD_NATIVE_WINDOW: A NativeWindowType
    (Filename: ./Runtime/GfxDevice/egl/WindowContextEGL.cpp Line: 205)

    Note 4
     
  15. eekgames

    eekgames

    Joined:
    May 23, 2014
    Posts:
    1
    I got the same error when I upgraded to Unity 5.3.2 (from 4.3.4) and tried to deploy my previously working game to my Nexus 7:

    Unable to acquire context: EGL_BAD_NATIVE_WINDOW: A NativeWindowType
    (Filename: ./Runtime/GfxDevice/egl/WindowContextEGL.cpp Line: 205)

    In my case I found the error was slightly misleading, and seemed to be caused by an earlier error: a call to Shader.Find("Standard") was returning null. It appears that Unity's stripping seemed to be working differently and had stripped out the standard shader (since I never directly referenced it).

    Hope that helps someone.
     
  16. poolts

    poolts

    Joined:
    Aug 9, 2012
    Posts:
    113
  17. exerion

    exerion

    Joined:
    Jun 29, 2011
    Posts:
    54
    We were getting a similar error log using Unity 5.3.5p2.

    06-20 17:01:25.949: E/Unity(6687): [EGL] Unable to acquire context: EGL_BAD_MATCH: Arguments are inconsistent (for example, a valid context requires buffers not supplied by a valid surface).

    We don't get this error with Unity 5.4.1. The problem is the beta breaks several other things so upgrading at this point is not an option for us since our project is live :(

    Did upgrading to 5.4.1 fix the issue for the rest of you?

    YAY! :D I just tested in Unity 5.3.5p4 and the crash is gone!
     
    Last edited: Jun 21, 2016
  18. _creatio_

    _creatio_

    Joined:
    Mar 21, 2013
    Posts:
    43
    Getting the error:
    [EGL] Unable to acquire context: EGL_BAD_NATIVE_WINDOW: A NativeWindowType argument does not refer to a valid native window.

    with Unity 5.5.0f3
    Does anyone still getting this issue?
     
  19. ForceMagic

    ForceMagic

    Joined:
    Feb 27, 2015
    Posts:
    38
    @_creatio_ I'm on Unity 5.5.2f1 and we have a sligtly different error that was reported in our log files. Seems like this is still happening, there is no callstack so it`s ready hard to see what's wrong.

    [EGL] Failed to create window surface: EGL_BAD_ALLOC: EGL failed to allocate resources for the requested operation.

    Edit:
    Occurs on the SAMSUNG SM-G920W8 running Android 6.0.1
     
  20. JOJOGT

    JOJOGT

    Joined:
    Jan 16, 2015
    Posts:
    2
    On SM-G9200, irregularly crash when I use assetbundle.
     
  21. Asse1

    Asse1

    Joined:
    Jan 9, 2013
    Posts:
    89
    On our devices we get the EGL error when we do the following:

    - Open app
    - Send app to background by pressing home-button
    - Re-open app by taping on the app-icon
    - ... see a nice black screen

    When we return to the app by using the task manager everything works fine. It happens on Unity 5.6.3 and up.

    Here's the error log:

    11-10 11:55:24.726: W/Adreno-EGL(18850): <qeglDrvAPI_eglMakeCurrent:3083>: EGL_BAD_ACCESS
    11-10 11:55:24.726: E/libEGL(18850): eglMakeCurrent:836 error 3002 (EGL_BAD_ACCESS)
    11-10 11:55:24.727: E/Unity(18850): [EGL] Unable to acquire context: EGL_BAD_ACCESS: EGL cannot access a requested resource (for example a context is bound in another thread).
    11-10 11:55:24.727: E/Unity(18850):
    11-10 11:55:24.727: E/Unity(18850): (Filename: ./Runtime/GfxDevice/egl/WindowContextEGL.cpp Line: 267)
     
  22. Vongolar

    Vongolar

    Joined:
    Jan 12, 2018
    Posts:
    3
    I'm getting a similar error log in Unity 2017.3.0f3

    E/libEGL: eglMakeCurrent:831 error 3002 (EGL_BAD_ACCESS)
    E/Unity: [EGL] Unable to acquire context: EGL_BAD_ACCESS: EGL cannot access a requested resource (for example a context is bound in another thread).
    (Filename: /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/egl/WindowContextEGL.cpp Line: 267)

    I export my project to Android Studio,and it worked well.

    I use"
    Intent intent=new Intent(UnityPlayer.currentActivity,TencentOpenActivity.class);
    UnityPlayer.currentActivity.startActivity(intent);"
    to open my activity ,and then finish this activity.It also worked well.

    However,I use"
    Tencent.login(TencentOpenActivity.this,"all",listener);"to open another app.
    When the app back to my application,I finish TencentOpenActivity.Then,I got a black Screen and the error log.
     
  23. Vongolar

    Vongolar

    Joined:
    Jan 12, 2018
    Posts:
    3
    I find it works well in Unity 5.3.6p.I'm not sure that is it related to my buildsetting?
     
  24. NWagter

    NWagter

    Joined:
    Jul 18, 2016
    Posts:
    1
    I am having the same problem.
    I am trying to get it to work in 2018 now

    -------------
    Didn't work :p


    ------------
    Seems like 2017.2 works too atleast for me!
     
    Last edited: Feb 13, 2018
  25. binario_unity

    binario_unity

    Joined:
    Oct 12, 2017
    Posts:
    2
    Had a kinda similar problem, after a week of debugging I noticed that it was the instantiation of graphic objects (MeshRenderers and such) while the app is in background, I believe the bug occurs when Unity tries to send information to the graphics processor and the OS already killed the surface / buffer or whatever (Im not the most technical dev) but its just a theory. Anyway, I made a flag when the app is loading and its in background and resume the instantiation of objects when the app goes foreground again.

    In our case this was happening when our users grew tired of loading times (or ads) and went to other apps in the meantime

    Hope this saves someone's time
     
    leni8ec, dmax9 and Yakirbu like this.
  26. dmax9

    dmax9

    Joined:
    Jun 10, 2015
    Posts:
    6
    Well it definitely save my time.
    2018.4.5f1 and most of advertising plugins update to newest version and suddenly I starter to face this issue. I'm creating object pools during first scene for various models (that had textures, shaders, particles, etc.), so now I postponed instantiation of these models until moment when main scene is loaded.
    So, your theory has good roots.
     
  27. MaxUnity111

    MaxUnity111

    Joined:
    Mar 25, 2019
    Posts:
    11
    Hi, did anyone find the reason for the critical error:
    [EGL] Unable to acquire context: EGL_BAD_NATIVE_WINDOW: A NativeWindowType argument does not refer to a valid native window.
     
  28. FMRAustinSnider

    FMRAustinSnider

    Joined:
    Sep 18, 2019
    Posts:
    4
    I am also running into this issue on some Android based mobile VR devices; specifically the Pico Neo 2. Any more insight into what causes this?
     
  29. apiotuch_unity

    apiotuch_unity

    Joined:
    Jun 28, 2019
    Posts:
    138
    We also got this issue today from a LENOVO/Lenovo TB-X606X/X606X (Lenovo Tab M10 Plus) Android 9.
     
    binoman likes this.
  30. Vadimskyi

    Vadimskyi

    Joined:
    Jan 13, 2020
    Posts:
    12
    Got the same error on Samsung S6, after which application just froze forever. Any info on how can I debug this issue?
    Unity 2019.4.5f
     
    binoman likes this.
  31. duongquangnam

    duongquangnam

    Joined:
    Feb 3, 2014
    Posts:
    1
    I got this problem in Unity 2020.3.3f1 (LTS). I created a simple project and imported google AdMob, I found this bug make GPU overload after 5 6 frames after something happened. I guess when admob show interstitial ads, have a job from CPU send to GPU while app in background mode and that job make GPU run a error command.=> GPU time slow down and completely stuck after few frames.
     
    wavs, azuma_unity and binoman like this.
  32. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    66
    I have this issue on multiple android devices. Unity 2019.4.26f1
     
  33. Danko37

    Danko37

    Joined:
    Aug 10, 2018
    Posts:
    1
    I have this issue on multiple android devices. Unity 2019.4.31f1
     
  34. Richard_p_02

    Richard_p_02

    Joined:
    Jun 18, 2019
    Posts:
    14
    I have this issue on multiple android devices. Unity 2019.4.17f1
     
  35. AzelGames

    AzelGames

    Joined:
    Feb 15, 2022
    Posts:
    1
    This issue is reported on Android Versions < 10.0. I didn't find this issue critical because its not effecting the gameplay.
     
  36. ibtesam

    ibtesam

    Joined:
    Jan 30, 2016
    Posts:
    1
    this isssue create ANR
     
  37. -chris

    -chris

    Joined:
    Mar 1, 2012
    Posts:
    99
    Getting this error on various Android devices:
    Unity 2021.3.10f1.

    "Graphics Jobs (Experimental)" is not enabled.

    Devices:

    motorola moto e(6) plus
    Android OS 9 / API-28 (PTBS29.401-58-8/58-8)

    motorola moto e(7)
    Android OS 10 / API-29 (QOFS30.569-83-11/45005)

    Xiaomi M2006C3LG
    Android OS 10 / API-29 (QP1A.190711.020/V12.0.20.0.QCDMIXM)
     
  38. DaveA_VR

    DaveA_VR

    Joined:
    May 26, 2022
    Posts:
    35
    Getting this with Unity 2022.3.4 on Pico Neo 3
     
  39. fazli_unity

    fazli_unity

    Joined:
    Nov 18, 2021
    Posts:
    5
    Also having this issue on 2021.3.33f1