Issue
MobileAds.initialize(this) { }
val adViewBottom = AdView(this)
adViewBottom.adSize = AdSize.BANNER
This worked before I updated the library, now I get
val cannot be reassigned
on
adViewBottom.adSize
changing val
to var
doesn't solve it
Solution
Admob 21.0.0 changed the way to set ad size directly.
You can use the setAdSize
method.
MobileAds.initialize(this) { }
val adViewBottom = AdView(this)
adViewBottom.setAdSize(AdSize.BANNER)
// adViewBottom.setAdSize(AdSize.FULL_BANNER)
// adViewBottom.setAdSize(... Anchored adaptive banner size ...)
Answered By - ocos
Answer Checked By - David Goodson (JavaFixing Volunteer)