gpt4 book ai didi

android - Admob SDK 错误代码 :0

转载 作者:行者123 更新时间:2023-11-30 02:34:09 25 4
gpt4 key购买 nike

我正在尝试在我的应用程序中添加 admob 广告。我遵循了 Google 教程,但它没有用。这是我的代码:

OnCreate() 方法中:

   AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest request = new AdRequest.Builder().build();
adView.loadAd(request);

主要 Activity xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" xmlns:app="http://schemas.android.com/apk/res/com.impact.ribony">



<com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="48dip"
app:pstsIndicatorColor ="#0B0B16"
app:pstsShouldExpand="true" />"

<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>


<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tabs">
</android.support.v4.view.ViewPager>


<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-XXXXXXXX" />

</RelativeLayout>

list :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxxxx.xxxx"
android:versionCode="8"
android:versionName="1.0.7" >

<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />

<application
android:name=".Trackers"
android:allowBackup="true"
android:icon="@drawable/xxxx_top_icon"
android:label="@string/app_name"
android:theme="@style/CustomActionBarTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.analytics.globalConfigResource"
android:resource="@xml/global_tracker" />
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.default_searchable"
android:value=".MainActivity" />

<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>

日志文件:

11-10 12:00:22.592: W/Ads(1950): There was a problem getting an ad response. ErrorCode: 0
11-10 12:00:22.592: D/dalvikvm(1950): GC_FOR_ALLOC freed 1321K, 15% free 8406K/9788K, paused 2ms, total 3ms
11-10 12:00:22.600: W/Ads(1950): Failed to load ad: 0

这可能是什么原因造成的?问题是什么 ?我不明白这个错误。

最佳答案

在我的例子中,代码是正确的,google-ply-services 已更新!

但我有一个新的 admob 帐户,带有新的横幅广告和插页式广告 ID!

用了2天&问题自动解决&开始显示广告...

关于android - Admob SDK 错误代码 :0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26843507/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com