Unity接入Admob

1. 细节参考文档

2. 安装依赖

  • Assets -> Google Mobile Ads -> Android -> Resolve
  • Assets -> Google Mobile Ads -> IOS -> cocopads

3. 报错

AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.ads.initialization.OnInitializationCompleteListener

Build Settings > Player Setting > Publishing Settings > Custom Progurard File

proguard-user.txt:

-keep class com.google.unity.** {
*;
}
-keep public class com.google.android.gms.ads.**{
public *;
}
-keep public class com.google.ads.**{
public *;
}
-keepattributes *Annotation*
-dontobfuscate