【发布时间】:2014-09-18 17:04:12
【问题描述】:
我最近向 Play 商店发布了一个应用程序,集成了 Play 服务以显示 admob 广告,检查了测试广告并更新到了 Play 商店。 该应用程序显示一个不错的数字。每天的广告展示次数和收入开始回升。
但是,从 9 月 15 日开始,展示次数突然下降。我检查了加载失败的测试广告
代码如下:
类文件
public class MyActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().addTestDevice("xxxxxxxxxxxxxxxxxxxx").build();
adView.loadAd(adRequest);
.
.
.
.
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.my, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_share:
Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("text/plain");
share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
share.putExtra(Intent.EXTRA_TEXT, "https://play.google.com/store/apps/details?id=com.akshitrewari.gateexampreparation");
startActivity(Intent.createChooser(share, "Share This App!"));
return true;
case R.id.action_settings:
Intent intent1 = new Intent(getApplicationContext(), Setting.class);
startActivity(intent1);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
XML 文件
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
.
.
.
.
>
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listView1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="60dp" />
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="ca-app-pub-xxxxxxxxxxxxxxx/xxxxxx"
ads:adSize="BANNER"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
日志(我在 8 月 26 日没有收到此错误,测试广告加载完美。现在我在 2014 年 9 月 18 日收到此错误
09-18 21:40:41.213 4016-4046/com.akshitrewari.gateexampreparation W/Ads﹕ Could not parse mediation config: {"ad_networks":[{"adapters":["com.google.DummyAdapter"],"allocation_id":"3735928559","data":{"gwhirl_share_location":"1"}}],"ad_type":"banner","qdata":"AJ5UM1lXCnTUhRTWdw1mn4N95P_d_H-dEl_XiuUswrMv-H_rTF-JkILfa5s-hbfPPseQD7178XqHBSpH-ONAihbPOYwWiKy-76Zl8NNtcHeoy-5i1Q","settings":{"click_urls":["http://e.admob.com/clk?qdata=@gw_qdata@&js=@gw_sdkver@&session_id=@gw_sessid@&seq_num=@gw_seqnum@&adt=@gw_adt@&aec=@gw_aec@&ad_network_id=@gw_adnetid@&allocation_id=@gw_allocid@&nr=@gw_adnetrefresh@&client=ca-app-pub-xxxxxxxxxx&slotname=xxxxxxx"],"imp_urls":["http://e.admob.com/imp?qdata=@gw_qdata@&js=@gw_sdkver@&session_id=@gw_sessid@&seq_num=@gw_seqnum@&adt=@gw_adt@&aec=@gw_aec@&ad_network_id=@gw_adnetid@&allocation_id=@gw_allocid@&nr=@gw_adnetrefresh@&client=ca-app-pub-xxxxxxxxxxx&slotname=xxxxxxx"],"nofill_urls":["http://e.admob.com/nofill?qdata=@gw_qdata@&js=@gw_sdkver@&session_id=@gw_sessid@&seq_num=@gw_seqnum@&adt=@gw_adt@&aec=@gw_aec@&client=ca-app-pub-xxxxxxxx&slotname=xxxxxxxx"],"refresh":60}}
09-18 21:40:41.233 4016-4016/com.akshitrewari.gateexampreparation W/Ads﹕ Failed to load ad: 0
以上部分日志出现在RED中
依赖
compile 'com.google.android.gms:play-services:4.4.52'
我使用这里建议的 4.4.52 版本,因为 v 5.0.77 出现错误
Android Studio & AdMob -- The following classes could not be instantiated
Android 清单
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.akshitrewari.gateexampreparation" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
// to download ads from internet
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
//Add Home screen Shortcut
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".MyActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
.
.
.
.
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</activity>
</application>
</manifest>
请注意,此代码工作 100% 正常,该应用已发布并产生了可观的收入,但现在无法正常工作,每天的收入几乎为零(该应用仍在产生与一周前相比,印象数减少了 20%。这意味着一些设备仍在接收广告,但大多数没有。今天仪表板上显示的填充率为 99%)
我不确定代码如何在测试后仅 20 天就停止工作,但这可能是由于 google play 服务的更新。当我上次测试它时,它是在 2014 年 8 月 26 日工作的。
但是,完全相同的代码在我的其他应用中运行!!
更新:我确实屏蔽了某个类别的广告,这些广告占展示次数的很大比例但没有收入(我知道我的应用程序的受众对该类别根本不感兴趣)。虽然这与问题没有任何联系,但问题发生在我这样做的一天后。我在取消屏蔽该类别后尝试过,但仍然没有测试广告。
该应用的当前安装量没有下降。事实上,它呈指数级增长。
如果有人知道为什么这段代码现在不起作用以及如何更正,请告诉我。
我想解决这个问题并尽快更新应用程序
【问题讨论】:
-
您能添加您的 AndroidManfiest,特别是与广告相关的任何部分吗?
-
@ianhanniballake : 我已经添加了 android manifest 文件(只省略了一长串活动)
-
您开始使用中介了吗?就像在中介中设置了另一个广告网络,但没有将其库包含在您的应用中。
-
@Kunalxigxag :不,我没有做任何与调解有关的事情,我只使用 admob。我什至没有在任何其他广告网络上注册
-
链接到有问题的应用?
标签: android admob google-play-services