Java Admob赢得';行不通
我尝试在Goceng项目中实施Admob。由于Admob发生了更改,我无法真正了解此项目的文档 我的错误是Java Admob赢得';行不通,java,android,admob,google-play-services,Java,Android,Admob,Google Play Services,我尝试在Goceng项目中实施Admob。由于Admob发生了更改,我无法真正了解此项目的文档 我的错误是 05-04 12:51:21.959: W/Ads(9017): There was a problem getting an ad response. ErrorCode: 1 很多其他人也买了这个项目,所以我认为代码写得很好,我没有改变任何东西 对于测试,我使用: AdRequest adRequest = new AdRequest.Builder().addTestDevice(
05-04 12:51:21.959: W/Ads(9017): There was a problem getting an ad response. ErrorCode: 1
很多其他人也买了这个项目,所以我认为代码写得很好,我没有改变任何东西
对于测试,我使用:
AdRequest adRequest = new AdRequest.Builder().addTestDevice("XXX").build();
ads.loadAd(adRequest);
Admob id看起来像
<string name="admob_id">ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx</string>
activity_home.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/darker_gray">
<FrameLayout
android:id="@+id/frame_content"
android:layout_above="@+id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="@string/admob_id"
ads:adSize="SMART_BANNER"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
您可以发布更多代码吗?根据你发布的内容很难说。请看我的编辑,希望这是你想要的。在活动\u home.XML
或片段
布局中查看XML?它在XML中,而不是片段布局中。你能发布活动\u home.XML
吗?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/darker_gray">
<FrameLayout
android:id="@+id/frame_content"
android:layout_above="@+id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="@string/admob_id"
ads:adSize="SMART_BANNER"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"/>
</RelativeLayout>