Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xamarin C# AdMob null error #2

Open
MegaTechnoLtd opened this issue Apr 20, 2017 · 3 comments
Open

Xamarin C# AdMob null error #2

MegaTechnoLtd opened this issue Apr 20, 2017 · 3 comments

Comments

@MegaTechnoLtd
Copy link

I try to connect with AdMob (Google Play Services Ads) Banner using Xamarin C# code, When I load:

adView.loadAd(adRequest);

Xamarin Show Error message ( System.NullReferenceException )

Please check the photo:
https://i.stack.imgur.com/bipES.png

The code and method here in:
https://github.com/hussien89aa/XamarinAndroidTutorial/blob/master/Admob.txt

I try to use different version of Emulators, SDKs and Google play services Ads versions (27.0 till 42.1002 Nougat) but still not work and show same error

My SDK library contain Google play Services and I use Visual Studio 2017

@MMF
Copy link

MMF commented Aug 9, 2017

I think you have to call SetContentView method at the beginning of OnCreate()

Ex:
SetContentView(Resource.Layout.Main);

I had the same issue and after adding this line it worked!

@MegaTechnoLtd
Copy link
Author

Thank you
That's right I solved the problem

1 similar comment
@MegaTechnoLtd
Copy link
Author

Thank you
That's right I solved the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants