Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 3    Views: 200

fusionmtx
Android Fan
Profile
Posts: 178
Reg: Jun 15, 2011
Orlando
2,180
12/12/12 11:32 PM (13 years ago)

Admob Integration Android issue

Ive been trying to add Admob to my app all day and everytime the App crashes and says my app has stopped working. here is my log of the error 12-13 01:15:41.660: E/AndroidRuntime(1682): FATAL EXCEPTION: main 12-13 01:15:41.660: E/AndroidRuntime(1682): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.v1_4.B60E6D01565D444A597A8FCB.com/com.hnn.WB_screen_menuImage}: android.view.InflateException: Binary XML file line #35: Error inflating class com.google.ads.AdView I would like to add ads to a tabbed layout or menu with image. Can someone assist me with this? Thanks :)
 
Sandeep
Android Fan
Profile
Posts: 1260
Reg: Feb 01, 2012
Miraj, India
25,250
like
12/13/12 02:35 AM (13 years ago)
I think that you are trying to add the banner ad through coding in the class files. Better option is to add it in the layout file. Check out the following post to see how you can add banner ads through xml coding. In case you still get errors then send me your project file in zipped format at my email add- sandeepkurne (at) gmail (dot) com. I will be pleased to see what exactly is happening wrong in there. http://www.buzztouch.com/forum/thread.php?tid=43A315FFC67787BDD76AAE4&command=isSearching&currentPage=1&topicTitle=admob&createdBy=&repliedBy=&minViews=-1&maxViews=-1&minReplies=-1&maxReplies=-1&forumCategory=
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
12/13/12 08:51 AM (13 years ago)
Sandeep is right, the easy option is adding code to the xml files. Adding to the class files is more technical but has more control of the ads.
 
AlmaR
Lost but trying
Profile
Posts: 73
Reg: Jun 13, 2011
location unknow...
5,630
like
04/06/13 03:11 PM (12 years ago)
I had the same problem and this is how I fixed it: You need to create a libs/ folder in your project, and physically put the AdMob SDK in the project OR in the Java Build Path, you must Order and Export the SDK jar. Otherwise, the jar doesn't get included when your apk gets compiled, and all hell breaks loose when you run AdMob code at runtime.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.