When you try to build Google AdMob Ads Windows Phone 7 sample show the following error message:
Xap packaging failed. Object reference not set to an instance of an object
In Italian
Xap packaging failed. Riferimento a un oggetto non impostato su un’istanza di oggetto.
Cause:
Into the WMAppManifest.xml file there is the following line:
[sourcecode lang=”XML”]
<BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
[/sourcecode]
but in the project not exists the Background.png file.
Solution:
Add Background.png image file like this:
to the project, then right-click your Background.png in Solution Explorer, select Properties and set Build Action to Content
NOTE: Apply these steps for Google.AdMob.Ads.Sample.Fundamentals and Google.AdMob.Ads.Sample.Intermediate projects.
Note 2: The very first time AdMob sees your publisher ID it may take up to two minutes to receive an ad. This initial two minute lag will recur every time the app goes unused for 24 hours.
Did my solution solve your problem? Leave a reply.
6 replies on “Google AdMob Ads Windows Phone 7 – “Xap packaging failed. Object reference not set to an instance of an object.””
Thank you, this helped.
But now I get a ‘NullReferenceException’ at runtime.
Hi, thank you for your comment.
Have you inserted your AdUnitID into the MainPage.xaml?
Am also getting NullReferenceExceptionâ at runtime??? i have added AdUnitId also đ
sorry It dispalying nothing (blank screen)
Hi kartheek04,
thank you for your reply. The very first time AdMob sees your publisher ID it may take up to two minutes to receive an ad. This initial two minute lag will recur every time the app goes unused for 24 hours.
Thank you!!