代码之家  ›  专栏  ›  技术社区  ›  TheOliveTurtle

为什么我的AdMob Bannerad没有出现?Unity安卓

  •  1
  • TheOliveTurtle  · 技术社区  · 6 年前

    我已经做了一个自定义的bannerad位置和大小公式,它在三星galaxy s7边缘工作得很好,因为它的分辨率是1440 x 2560像素(高x宽)(横向),这使得bannerad的大小应该是254 x 83像素(宽x高),位置应该是372,213(x,y)。

    这是我用来为每个屏幕大小(分辨率)动态获取这些值的公式。

    int w, h, x, y;
        w = Mathf.FloorToInt(Screen.width / 10.07f);
        h = Mathf.FloorToInt(Screen.height / 17.3f);
        x = Mathf.FloorToInt(Screen.width / 6.8f);
        y = Mathf.FloorToInt(Screen.height / 6.7f);
    

    附言:它在三星Galaxy S7边缘上运行良好。以下是预览: enter image description here

    我在中兴刀片L3上测试了完全相同的应用程序,结果一无所获,其他类型的广告效果都很好,但就是这样。 这是我拍下来的一只logcat来获取更多信息。

    --------- beginning of system
    
    --------- beginning of main
    
    I/Unity   ( 3589): SystemInfo CPU = ARMv7 VFPv3 NEON, Cores = 4, Memory = 964mb
    
    I/Unity   ( 3589): SystemInfo ARM big.LITTLE configuration: 4 big (mask: 15), 0 little (mask: 0)
    
    I/Unity   ( 3589): ApplicationInfo com.pfeHY.sevenApocalypseSins version 1.6 build d3f911aa-1262-4fd6-90fb-2e0bd54ecee0
    
    I/Unity   ( 3589): Built from '2017.3/release' branch, Version '2017.3.1f1 (fc1d3344e6ea)', Build type 'Release', Scripting Backend 'mono'
    
    E/Unity   ( 3589): [EGL] eglChooseConfig(m_EGLDisplay, configAttribs, NULL, 0, &eglConfigCount): EGL_BAD_ATTRIBUTE: An unrecognized attribute or attribute value was passed in the attribute list.
    
    E/Unity   ( 3589): Stacktrace is not supported on this platform. 
    
    E/Unity   ( 3589): (Filename: /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/egl/ConfigEGL.cpp Line: 376)
    
    E/Unity   ( 3589): 
    
    E/Unity   ( 3589): [EGL] eglChooseConfig(m_EGLDisplay, configAttribs, NULL, 0, &eglConfigCount): EGL_BAD_ATTRIBUTE: An unrecognized attribute or attribute value was passed in the attribute list.
    
    E/Unity   ( 3589): Stacktrace is not supported on this platform. 
    
    E/Unity   ( 3589): (Filename: /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/egl/ConfigEGL.cpp Line: 376)
    
    E/Unity   ( 3589): 
    
    E/Unity   ( 3589): [EGL] eglChooseConfig(m_EGLDisplay, configAttribs, NULL, 0, &eglConfigCount): EGL_BAD_ATTRIBUTE: An unrecognized attribute or attribute value was passed in the attribute list.
    
    E/Unity   ( 3589): Stacktrace is not supported on this platform. 
    
    E/Unity   ( 3589): (Filename: /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/egl/ConfigEGL.cpp Line: 376)
    
    E/Unity   ( 3589): 
    
    E/Unity   ( 3589): [EGL] eglChooseConfig(m_EGLDisplay, configAttribs, NULL, 0, &eglConfigCount): EGL_BAD_ATTRIBUTE: An unrecognized attribute or attribute value was passed in the attribute list.
    
    E/Unity   ( 3589): Stacktrace is not supported on this platform. 
    
    E/Unity   ( 3589): (Filename: /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/egl/ConfigEGL.cpp Line: 376)
    
    E/Unity   ( 3589): 
    
    E/Unity   ( 3589): [EGL] eglChooseConfig(m_EGLDisplay, configAttribs, NULL, 0, &eglConfigCount): EGL_BAD_ATTRIBUTE: An unrecognized attribute or attribute value was passed in the attribute list.
    
    E/Unity   ( 3589): Stacktrace is not supported on this platform. 
    
    E/Unity   ( 3589): (Filename: /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/egl/ConfigEGL.cpp Line: 376)
    
    E/Unity   ( 3589): 
    
    E/Unity   ( 3589): [EGL] eglChooseConfig(m_EGLDisplay, configAttribs, NULL, 0, &eglConfigCount): EGL_BAD_ATTRIBUTE: An unrecognized attribute or attribute value was passed in the attribute list.
    
    E/Unity   ( 3589): Stacktrace is not supported on this platform. 
    
    E/Unity   ( 3589): (Filename: /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/egl/ConfigEGL.cpp Line: 376)
    
    E/Unity   ( 3589): 
    
    D/Unity   ( 3589): GL_EXT_debug_marker GL_OES_texture_npot GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_depth24 GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth_texture GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 GL_OES_vertex_half_float GL_EXT_blend_minmax GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_rgb8_rgba8 GL_EXT_multisampled_render_to_texture GL_EXT_discard_framebuffer GL_OES_get_program_binary GL_ARM_mali_program_binary GL_EXT_shader_texture_lod GL_EXT_robustness GL_OES_depth_texture_cube_map GL_KHR_debug 
    
    W/Unity   ( 3589): OnLevelWasLoaded was found on GameManager
    
    W/Unity   ( 3589): This message has been deprecated and will be removed in a later version of Unity.
    
    W/Unity   ( 3589): Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed
    
    W/Unity   ( 3589): Stacktrace is not supported on this platform. 
    
    W/Unity   ( 3589): (Filename:  Line: 375)
    
    W/Unity   ( 3589): 
    
    I/Unity   ( 3589): FMOD Studio: Device ZTE ZTE Blade L3 classed as MobileLow
    
    I/Unity   ( 3589): Screen size
    
    I/Unity   ( 3589): width=854, height=480
    
    I/Unity   ( 3589): BannerAd stats
    
    I/Unity   ( 3589): x=125, y=71, w=84, h=27
    
    E/Unity   ( 3589): AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewTreeObserver com.google.android.gms.ads.AdView.getViewTreeObserver()' on a null object reference
    
    E/Unity   ( 3589): java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewTreeObserver com.google.android.gms.ads.AdView.getViewTreeObserver()' on a null object reference
    
    E/Unity   ( 3589):  at com.google.unity.ads.Banner.destroy(Banner.java:328)
    
    E/Unity   ( 3589):  at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    
    E/Unity   ( 3589):  at com.unity3d.player.UnityPlayer.c(Unknown Source)
    
    E/Unity   ( 3589):  at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source)
    
    E/Unity   ( 3589):  at android.os.Handler.dispatchMessage(Handler.java:102)
    
    E/Unity   ( 3589):  at android.os.Looper.loop(Looper.java:189)
    
    E/Unity   ( 3589):  at com.unity3d.player.UnityPlayer$c.run(Unknown Source)
    
    E/Unity   ( 3589):   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0 
    
    E/Unity   ( 3589):   at UnityEngine.AndroidJNISafe.CallVoidMethod (IntPtr obj, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown>:0 
    
    E/Unity   ( 3589):   at UnityEngine.
    
    E/Unity   ( 3589): AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewTreeObserver com.google.android.gms.ads.AdView.getViewTreeObserver()' on a null object reference
    
    E/Unity   ( 3589): java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewTreeObserver com.google.android.gms.ads.AdView.getViewTreeObserver()' on a null object reference
    
    E/Unity   ( 3589):  at com.google.unity.ads.Banner.destroy(Banner.java:328)
    
    E/Unity   ( 3589):  at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    
    E/Unity   ( 3589):  at com.unity3d.player.UnityPlayer.c(Unknown Source)
    
    E/Unity   ( 3589):  at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source)
    
    E/Unity   ( 3589):  at android.os.Handler.dispatchMessage(Handler.java:102)
    
    E/Unity   ( 3589):  at android.os.Looper.loop(Looper.java:189)
    
    E/Unity   ( 3589):  at com.unity3d.player.UnityPlayer$c.run(Unknown Source)
    
    E/Unity   ( 3589):   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0 
    
    E/Unity   ( 3589):   at UnityEngine.AndroidJNISafe.CallVoidMethod (IntPtr obj, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown>:0 
    
    E/Unity   ( 3589):   at UnityEngine.
    
    0 回复  |  直到 6 年前