无法使AdMob在Android上运行:错误代码0 [英] Cannot get AdMob to work on Android : ErrorCode 0

查看:372
本文介绍了无法使AdMob在Android上运行:错误代码0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对此感到非常绝望。我按照Google在 https://developers.google.com/admob/ android / quick-start 网页,但仍然无法正常运行 menu.java 中的
实例化我的代码(或至少与AdMob有关的部分) code>类:

I am getting really desperate with this. I followed the given instructions by Google at the https://developers.google.com/admob/android/quick-start webpage but it still didn't work My code (or at least the part that has to do with AdMob) Instantiation in the menu.java class:

AdView adView = (AdView) findViewById(R.id.myaddview); //add the cast
AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .build();
adView.loadAd(adRequest);

XML中的横幅对于 banner_ad_unit_id,我使用了从AdMob帐户中获得的ID。我什至尝试为不同的应用制作多个不同的广告(不同的adID并仍然得到相同的结果)

The Banner in XML For the "banner_ad_unit_id" I used the ID that I got from my AdMob account. I even tried making multiple different ads for different applications (different adID's and still got the same results)

 <com.google.android.gms.ads.AdView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    ads:adSize="SMART_BANNER"
    android:id="@+id/myaddview"
    ads:adUnitId="@string/banner_ad_unit_id"
    android:layout_below="@+id/button4"/>

我的清单片段:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
    android:allowBackup="true"
    android:icon="@mipmap/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="com.google.android.gms.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

Gradle的 build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.google.android.gms:play-services:8.1.0'
}

minSDK是21(出于测试目的(但其>大于9,所以应该不成问题)

And the minSDK is 21 (for testing purposes(but its > than 9 so it shouldn't be a problem )

我还从SDK管理器更新了Google Play服务,并在logcat中得到了它:

I also updated the Google Play Services from the SDK manager and I get this in the logcat :

09-28 00:53:59.798  15533-15693/com.example.slaven.toplel W/Ads﹕ There was a problem getting an ad response. ErrorCode: 0
09-28 00:53:59.816  15533-15533/com.example.slaven.toplel W/Ads﹕ Failed to load ad: 0

有趣的是,无论使用什么代码,我都会遇到该错误:我什至在 https://github.com/googleads/googleads-mobile-android-examples ,并且在LogCat中仍然获得了相同的代码。运行应用后,我进入了AdMob帐户,发现有0个AdMob网络请求。
任何帮助将不胜感激!

The interesting part is that i get that error no matter what code I use : I even used Google's adMob example on https://github.com/googleads/googleads-mobile-android-examples and still got the same code in the LogCat. After I ran my app I went to my AdMob account and noticed that there are 0 AdMob network requests. Any help would be greatly appreciated!

推荐答案

看来,自定义ROM我在手机上安装的包含一个AdBlock插件。所以我换了Cyanogenmod,没有其他问题了。

It appears that the custom ROM that I had installed on my phone contained an AdBlock plugin. So I changed to Cyanogenmod and had no further issues.

这篇关于无法使AdMob在Android上运行:错误代码0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆