If the problem is situated in ad.loadAd(request);
this is probably a problem with the id adView
not existing in your activity_main
layout.
Or maybe there is something wrong with the initialisation of the AdRequest
. Maybe you can check why one of these elements is null
. Because when you know which of them is null
you can try to solve the problem.