I'm trying to add AdMob to my application. I followed instructions listed here , but it will lead to error which below imports are failed and com.google.android.gms.ads
cannot be resolved:
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
Here is my root gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
// ...
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
and here is my app .gradle file:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.firebase:firebase-core:9.4.0'
}
apply plugin: 'com.google.gms.google-services'
I think that you forgot to include admob dependency :
compile 'com.google.firebase:firebase-ads:9.4.0'
a core package is just analytics as stated here : https://firebase.google.com/docs/android/setup#available_libraries
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.