
Android StudioのAdMobによるバナー広告(java)の設定に関する質問です。
Google Mobile Ads SDK の設定でつまずいています。
https://developers.google.com/admob/android/quick-start?hl=ja#import_the_mobile_ads_sdk
上記のURLの説明では、build.gradleに以下のように記述するとあります。
buildscript {
repositories {
google()
mavenCentral()
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
しかし、当方のbuild.gradleの設定は以下のようになっており、様々な方法で追記を行なってもエラーとなってしまいます。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
例1:plugins {}の上にコピペした場合
only buildscript {} and other plugins {} script blocks are allowed before plugins {} blocks, no other statements are allowed
例2:
task clean(type: Delete){}の下にコピペした場合
all buildscript {} blocks must appear before any plugins {} blocks in the script
buildscript{}に関しましては、plugins {}の上にコピペすればエラーが起こりません。
ただ、allprojects の記述がどうしてもうまくいきません。
アドバイスをよろしくお願いいたします。

