AdMob Banner Ad Not Showing in Fragment {Kotlin}

420 views
Skip to first unread message

Unforgettable _Guy

unread,
Jun 3, 2018, 11:53:54 AM6/3/18
to Google Mobile Ads SDK Developers
I am Beginner. I have created an app with fragment and I want to place Banner Ad in fragment activity.
 But it Showing Unreachable Code and Its not working. If i used same code in Main activity. It works without showing Any Error..
please help me to fix it...
Capture.JPG

mobileadssdk-a...@google.com

unread,
Jun 4, 2018, 4:02:18 AM6/4/18
to Unforgettable _Guy, Google Mobile Ads SDK Developers
Hi,

Thank you for providing us a screenshot of your code snippets.

Based on the code snippets, you seem to be calling the return function (directly returning the inflated layout) before your code snippets for the AdRequest which is why it was marked as Unreachable Code.

Call the return function after the Ad Request and see if the "Unreachable Code" warning persists. On another note, it seems like your adView2 was never instantiated.

Regards,
Ivan Bautista
Mobile Ads SDK Team 
Reply all
Reply to author
Forward
0 new messages