Skip to content

Instantly share code, notes, and snippets.

@LethalMaus
Created December 6, 2023 20:24
Show Gist options
  • Select an option

  • Save LethalMaus/0efbcf5f0566954e72d493e8aeb0cf00 to your computer and use it in GitHub Desktop.

Select an option

Save LethalMaus/0efbcf5f0566954e72d493e8aeb0cf00 to your computer and use it in GitHub Desktop.
admob.gradle
android {
// ... (other configurations)
buildTypes {
debug {
// Set default AdMob ID and ad unit IDs for the debug build
resValue("string", "ADMOB_ID", "\"ca-app-pub-3940256099942544~3347511713\"")
buildConfigField("String", "BANNER_AD", "\"ca-app-pub-3940256099942544/6300978111\"")
buildConfigField("String", "REWARD_AD", "\"ca-app-pub-3940256099942544/5224354917\"")
}
release {
// Use AdMob ID and ad unit IDs from gradle.properties for the release build
resValue("string", "ADMOB_ID", gradleLocalProperties(rootDir).getProperty("ADMOB_ID"))
buildConfigField("String", "BANNER_AD", gradleLocalProperties(rootDir).getProperty("BANNER_AD"))
buildConfigField("String", "REWARD_AD", gradleLocalProperties(rootDir).getProperty("REWARD_AD"))
}
}
}
dependencies {
// Add the AdMob SDK dependency
implementation "com.google.android.gms:play-services-ads:22.5.0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment