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

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+c__Iterator1.MoveNext () [0x00000] in :0
I/Unity (14122): UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
I/Unity (14122): UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
I/Unity (14122): UnityEngine.Advertisements.AsyncExec:runWithCallback(Func3, HTTPRequest, Action1)
I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.HTTPRequest:execute(Action1)** **I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.RetryRequest:retry()** **I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.RetryRequest:execute(Action1)
I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.HTTPManager:sendRequest(HTTPRequest, Action1, Int32[ ], Int32)** **I/Unity (14122): UnityEngine.Advertisements.Event.Event:execute(Action1)
I/Unity (14122): UnityEngine.Advertisements.Event.EventManager:executeEvent(Boolean, String, String, Action1)** **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(Func3, HTTPRequest, Action1) I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.HTTPRequest:execute(Action1)
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+c__Iterator1.MoveNext () [0x00000] in :0
I/Unity (14122): UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
I/Unity (14122): UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
I/Unity (14122): UnityEngine.Advertisements.AsyncExec:runWithCallback(Func3, HTTPRequest, Action1)
I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.HTTPRequest:execute(Action1) I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.RetryRequest:retry() I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.RetryRequest:execute(Action1)
I/Unity (14122): UnityEngine.Advertisements.HTTPLayer.HTTPManager:sendRequest(HTTPRequest, Action1, Int32[ ], Int32) I/Unity (14122): UnityEngine.Advertisements.Event.Event:execute(Action1)
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!
*

1 Like

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:

<linker>
    <assembly fullname="UnityEngine">
        <type fullname="UnityEngine.WWW" preserve="all" />
    </assembly>
</linker>
1 Like

It was indeed missing. Thanks a lot! :slight_smile:

1 Like