Search Unity

Having trouble with UnityAds in Android when stripping level is anything but disabled

Discussion in 'Unity Ads & User Acquisition' started by bncastle, Oct 24, 2014.

  1. bncastle

    bncastle

    Joined:
    Jul 22, 2013
    Posts:
    6
    Hello,

    I've been trying to integrate UnityAds into my latest project and everything has gone smoothly and worked fine...until I changed the build stripping level in Android from disabled to anything else. Basically, when any type of stripping is enabled, I get the following exception as seen below. It happens right after I call the Advertisement.Initialize() method. I am running Unity Pro 4.6 Beta 21, so that might have something to do with it. Any thoughts? Is this expected? I can supply a test project that demonstrates this if needed.

    Thanks


    D/Unity (14122): ffer_float GL_EXT_color_buffer_half_float GL_EXT_disjoint_timer_query

    I/Unity (14122): NullReferenceException: Object reference not set to an instance of an object
    I/Unity (14122): at UnityEngine.Advertisements.HTTPLayer.HTTPRequest+<executePost>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0
    I/Unity (14122): UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
    I/Unity (14122): UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    I/Unity (14122): UnityEngine.Advertisements.AsyncExec:runWithCallback(Func`3, HTTPRequest, Action`1)
    I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.HTTPRequest:execute(Action`1)
    I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.RetryRequest:retry()
    I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.RetryRequest:execute(Action`1)
    I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.HTTPManager:sendRequest(HTTPRequest, Action`1, Int32[], Int32)
    I/Unity (14122): UnityEngine.Advertisements.Event.Event:execute(Action`1)
    I/Unity (14122): UnityEngine.Advertisements.Event.EventManager:executeEvent(Boolean, String, String, Action`1)
    I/Unity (14122): UnityEngine.Advertisements.Event.EventManager:sendEvent(Boolean, String)
    I/Unity (14122): UnityEngine.Advertisements.Event.EventManager:sendStartEvent(String)

    I/Unity (14122): UnityEngine.Advertisements.Engine:In
    I/Unity (14122): NullReferenceException: Object reference not set to an instance of an object
    I/Unity (14122): at UnityEngine.Advertisements.HTTPLayer.HTTPRequest+<executePost>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0
    I/Unity (14122): UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
    I/Unity (14122): UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    I/Unity (14122): UnityEngine.Advertisements.AsyncExec:runWithCallback(Func`3, HTTPRequest, Action`1)
    I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.HTTPRequest:execute(Action`1)
    I/Unity (14122): UnityEngine.Advertisements.ConfigManager:RequestConfig()
    I/Unity (14122): UnityEngine.Advertisements.Engine:Initialize(String, Boolean)
    I/Unity (14122): UnityEngine.Advertisements.Advertisement:Initialize(String, Boolean)
    I/Unity (14122): Adverter:Init()
    I/Unity (14122): Adverter:Awake()
    I/Unity (14122):
    I/Unity (14122): (Filename: Line: -1)
    I/Unity (14122):
    I/Unity (14122): NullReferenceException: Object reference not set to an instance of an object
    I/Unity (14122): at UnityEngine.Advertisements.HTTPLayer.HTTPRequest+<executePost>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0
    I/Unity (14122): UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
    I/Unity (14122): UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    I/Unity (14122): UnityEngine.Advertisements.AsyncExec:runWithCallback(Func`3, HTTPRequest, Action`1)
    I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.HTTPRequest:execute(Action`1)
    I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.RetryRequest:retry()
    I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.RetryRequest:execute(Action`1)
    I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.HTTPManager:sendRequest(HTTPRequest, Action`1, Int32[], Int32)
    I/Unity (14122): UnityEngine.Advertisements.Event.Event:execute(Action`1)
    I/Unity (14122): UnityEngine.Advertisements.Event.EventManager:executeEvent(Boolean, String, String, Action`1)
    I/Unity (14122): UnityEngine.Advertisements.Event.EventManager:sendEvent(Boolean, String)
    I/Unity (14122): UnityEngine.Advertisements.Event.EventManager:sendMediationInitEvent(String)
    I/Unity (14122): UnityEngine.Advertisements.E
    W/Unity (14122): *** UnityAds is currently in TEST mode! Set to false before releasing!***
     
    Last edited: Oct 24, 2014
    HeikkiTunkelo likes this.
  2. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    Looks like Stripping might be removing classes needed by Unity Ads.
    The Unity Ads asset package does include a link.xml file. The file may be missing from your project, or if you already had your own in your project, you may not have included it when importing Unity Ads.

    Make sure a link.xml file exists within the Assets directory of your project with at least the following contents:
    Code (xml):
    1. <linker>
    2.     <assembly fullname="UnityEngine">
    3.         <type fullname="UnityEngine.WWW" preserve="all" />
    4.     </assembly>
    5. </linker>
     
    HeikkiTunkelo likes this.
  3. bncastle

    bncastle

    Joined:
    Jul 22, 2013
    Posts:
    6
    It was indeed missing. Thanks a lot! :)
     
    unity-nikkolai likes this.