目录
关闭Google全屏广告
com.google.android.gms.ads.AdActivity
.method protected onCreate(Landroid/os/Bundle;)V
.locals 1
invoke-super {p0, p1}, Landroid/app/Activity;->onCreate(Landroid/os/Bundle;)V
invoke-virtual {p0}, Landroid/app/Activity;->finish()V
return-void
.end method
隐藏Google横幅广告
com.google.android.gms.ads.BaseAdView
The ad size can only be set once on AdView
The ad unit ID can only be set once on AdView.
.method public onLayout(ZIIII)V
.locals 2
const/4 p1, 0x0
invoke-virtual {p0, p1}, Landroid/view/ViewGroup;->getChildAt(I)Landroid/view/View;
move-result-object p1
if-eqz p1, :cond_0
invoke-virtual {p1}, Landroid/view/View;->getVisibility()I
move-result v0
const/16 v1, 0x8
if-eq v0, v1, :cond_0
const/16 v1, 0x8
invoke-virtual {p1, v1}, Landroid/view/View;->setVisibility(I)V
invoke-virtual {p1}, Landroid/view/View;->getMeasuredWidth()I
move-result v0
invoke-virtual {p1}, Landroid/view/View;->getMeasuredHeight()I
move-result v1
sub-int/2addr p4, p2
sub-int/2addr p4, v0
div-int/lit8 p4, p4, 0x2
sub-int/2addr p5, p3
sub-int/2addr p5, v1
div-int/lit8 p5, p5, 0x2
add-int/2addr v0, p4
add-int/2addr v1, p5
invoke-virtual {p1, p4, p5, v0, v1}, Landroid/view/View;->layout(IIII)V
:cond_0
return-void
.end method
Google广告
googleAdViewId为ad_container
首先在AndroidManifest.xml文件内搜索ads关键字,将关于com.google.android.gms.ads的标签全部删除
去除后直接打包运行会崩溃
全局搜索
You must have the following declaration within the <application> element: <meta-data android:name=\"com.google.android.gms.version\" android:value=\"@integer/google_play_services_version\" />
或
You must have the following declaration with
搜索结果可能会出现多个
找到方法结尾为 (Landroid/content/Context;I)I 的方法
或IllegalStateException异常
定位该方法
使其返回0
示例
com.google.android.gms.common.GooglePlayServicesUtilLight
.method public static isGooglePlayServicesAvailable(Landroid/content/Context;I)I
.locals 3
.annotation runtime Ljava/lang/Deprecated;
.end annotation
const/4 v0, 0x0
return v0
.end method
或定位
com.google.android.gms.ads.MobileAds
清除其中
initialize
googleNativeAD占位移除
admob_appopen
com.google.android.gms.ads.appopen.AppOpenAd
public static void load(final Context context, final String str, final AdRequest adRequest, final int i, final AppOpenAdLoadCallback appOpenAdLoadCallback) {
Preconditions.checkNotNull(context, "Context cannot be null.");
Preconditions.checkNotNull(str, "adUnitId cannot be null.");
Preconditions.checkNotNull(adRequest, "AdRequest cannot be null.");
Preconditions.checkMainThread("#008 Must be called on the main UI thread.");
zzbhz.zzc(context);
if (((Boolean) zzbjn.zzd.zze()).booleanValue()) {
if (((Boolean) zzay.zzc().zzb(zzbhz.zziv)).booleanValue()) {
zzcex.zzb.execute(new Runnable() { // from class: com.google.android.gms.ads.appopen.zzb
@Override // java.lang.Runnable
public final void run() {
Context context2 = context;
String str2 = str;
AdRequest adRequest2 = adRequest;
try {
new zzbco(context2, str2, adRequest2.zza(), i, appOpenAdLoadCallback).zza();
} catch (IllegalStateException e) {
zzbyy.zza(context2).zzd(e, "AppOpenAd.load");
}
}
});
return;
}
}
new zzbco(context, str, adRequest.zza(), i, appOpenAdLoadCallback).zza();
}
admob_banner
com.google.android.gms.ads.BaseAdView
public void setAdUnitId(String str) {
this.zza.zzu(str);
}
public final void zzu(String str) {
if (this.zzl == null) {
this.zzl = str;
return;
}
throw new IllegalStateException("The ad unit ID can only be set once on AdView.");
}
public void loadAd(final AdRequest adRequest) {
Preconditions.checkMainThread("#008 Must be called on the main UI th