Can not integrate Admob with Google Play service

142 views
Skip to first unread message

Josue Rodriguez

unread,
Jun 4, 2014, 11:01:00 AM6/4/14
to google-adm...@googlegroups.com
Hello,

I'm new on this forum. Just want to know how to integrate Admob ads on my app.

NOTE: I'm building this app using Buzztouch services (buzztouch.com)

I've followed all steps from this guide: https://developers.google.com/mobile-ads-sdk/docs/?hl=en_US

But when I try to add a com.google.android.gms.ads.AdView (the second part of the guide https://developers.google.com/mobile-ads-sdk/docs/admob/fundamentals#play) I have problems on my project. This is what I've done:

1. I've added:

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;

2. I've added:

private AdView adView;

private static final String AD_UNIT_ID = "INSERT_YOUR_AD_UNIT_ID_HERE"; (also replaced with my ID)

3. I've added:

// Create an ad.
   adView = new AdView(this);
   adView.setAdSize(AdSize.BANNER);
   adView.setAdUnitId(AD_UNIT_ID);

But I get error on that red part.

My .java file is different than the one shown as example..
Can someone help me please?

I will attach my .java file for you to see it :)
Sp_youtube_android.java

Eric Leichtenschlag

unread,
Jun 4, 2014, 7:47:26 PM6/4/14
to google-adm...@googlegroups.com
Hello,

You're probably getting a compile error there because you don't have the Google Play services library added as a dependency, so the compiler doesn't know what an AdView is. Google Play services can be retrieved from the "Extras" section in Android's SDK manager. There are directions here on how to get it and add the library to your workspace, and then steps here on how to have your project reference the Google Play services project.

Also note that once you get Google Play services set up, you'll want to attach the ad to your layout somewhere and call adView.loadAd(new AdRequest.Builder.build()); to start loading ads.

Hope this helps,
Eric

James

unread,
Jun 4, 2014, 10:16:08 PM6/4/14
to google-adm...@googlegroups.com
Hello,

It is usually because of some misconfiguration in your manifest file. First, please check about your user permission part, then meta-data in application section. Last, the ads activity,

This post gives a full version of example. It may help you.



--

---
You received this message because you are subscribed to the Google Groups "Google AdMob Ads Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Josue Rodriguez

unread,
Jun 5, 2014, 10:03:22 AM6/5/14
to google-adm...@googlegroups.com
Hello, thanks both of you.

Actually, I've already added Google play library into my project :(

Can I share my .java and .xml files and you tell what code do I have to include?

Thanks :l

Eric Leichtenschlag

unread,
Jun 5, 2014, 3:57:05 PM6/5/14
to google-adm...@googlegroups.com
I could help you with calling loadAd, but as far as fixing the compile error on new AdView(this), that seems like a project configuration you'll need to fix. I'm not familiar with the Buzztouch framework. Is your project loaded into an IDE such as Eclipse, Intellij Idea or Android Studio?

Josue Rodriguez

unread,
Jun 6, 2014, 6:29:05 AM6/6/14
to google-adm...@googlegroups.com
Hi Eric,

Yes, I'm working with Eclipse. Ok, let me see if I can solve that problem first :l




--

---
You received this message because you are subscribed to a topic in the Google Groups "Google AdMob Ads Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-admob-ads-sdk/P1gYb1rdLWo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-admob-ads...@googlegroups.com.

Josue Rodriguez

unread,
Jun 6, 2014, 9:46:14 AM6/6/14
to google-adm...@googlegroups.com
Finally, I could solve the issue! :)

I followed the guide created by piggilypoo at Buzztouch forums.

Thanks everyone here!!


El miércoles, 4 de junio de 2014 12:01:00 UTC-3, Josue Rodriguez escribió:

Josue Rodriguez

unread,
Jun 6, 2014, 9:47:18 AM6/6/14
to google-adm...@googlegroups.com

Anugrah Redja Kusuma

unread,
Jun 12, 2014, 7:24:53 PM6/12/14
to google-adm...@googlegroups.com
Hi Josue,

It seems that you're creating the AdView inside of a Fragment (BT_fragment)?

The first parameter for AdView constructor is a Context, so you should
call this instead:

    adView = new AdView(getActivity());

Hope it solve the problem.

Regards


--

---
You received this message because you are subscribed to the Google Groups "Google AdMob Ads Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-ark

Josue Rodriguez

unread,
Jun 13, 2014, 8:48:35 AM6/13/14
to google-adm...@googlegroups.com
Thanks Anugrah!

Finally I could solve it! I follow the instructions provided by one Buzztouch member on their forums :)

But, I appreciate your support. Thanks dude!
Reply all
Reply to author
Forward
0 new messages