2012-12-11 3 views
0

AdMob 광고가 내 Android 앱에 표시되지 않습니다. XML 메소드를 사용하여 admob 코드를 구현했습니다. 추가는 나타나지 않지만 admob .. (100 % 채우기 비율의 8 요청)로 요청을 보냅니다. 내가 뭘 놓치고 있니? 및 admob 광고의 XML 구현에서 테스트 모드를 활성화하는 방법?Admob 광고가 내 앱에 표시되지 않습니다.

다음
<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/ScrollView01" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@layout/back2" 
     android:orientation="vertical" 
     android:padding="30dip" > 

     <com.google.ads.AdView 
      xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
      android:id="@+id/adView1" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      ads:adSize="BANNER" 
      ads:adUnitId="AdMob ID" 
      ads:loadAdOnCreate="true" 
      ads:testDevices="TEST_EMULATOR" /> 

     <TextView 
      android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="60dp" 
      android:text="@string/hello" 
      android:textSize="15sp" /> 

     <Button 
      android:id="@+id/button1" 
      android:layout_width="fill_parent" 
      android:layout_height="60dp" 
      android:layout_marginTop="50dp" 
      android:background="@color/buttonc1" 
      android:text="@string/tutorials" 
      android:textSize="21sp" /> 

     <Button 
      android:id="@+id/button2" 
      android:layout_width="fill_parent" 
      android:layout_height="60dp" 
      android:layout_marginTop="30dp" 
      android:background="@color/buttonc3" 
      android:text="@string/themes" 
      android:textSize="21sp" /> 

     <Button 
      android:id="@+id/button3" 
      android:layout_width="fill_parent" 
      android:layout_height="60dp" 
      android:layout_marginTop="30dp" 
      android:background="@color/buttonc2" 
      android:text="@string/gadgets" 
      android:textSize="21sp" /> 

     <Button 
      android:id="@+id/button4" 
      android:layout_width="fill_parent" 
      android:layout_height="60dp" 
      android:layout_marginTop="30dp" 
      android:background="@color/buttonc4" 
      android:text="@string/networking" 
      android:textSize="21sp" /> 

     <Button 
      android:id="@+id/button5" 
      android:layout_width="fill_parent" 
      android:layout_height="60dp" 
      android:layout_marginTop="30dp" 
      android:background="@layout/button5" 
      android:text="@string/win8index" 
      android:textColor="#D5D5D5" 
      android:textSize="21sp" /> 
    </LinearLayout> 

</ScrollView> 

가 manifest.xml 파일

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="org.core.mywindows8" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk 
     android:minSdkVersion="8" 
     android:targetSdkVersion="17" /> 

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

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name="org.core.mywindows8.Corefile" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity 
      android:name=".Contenturl" 
      android:label="My Windows 8" > 
     </activity> 
     <activity 
      android:name=".Tutorial" 
      android:label="Tutorial Categories" > 
     </activity> 
     <activity 
      android:name=".MainActivity" 
      android:label="General Troubleshoot" > 
     </activity> 
     <activity 
      android:name=".Myfeed" 
      android:label="Tutorial Categories" > 
     </activity> 
     <activity 
      android:name=".MyWindows" 
      android:label="My Windows 8" > 
     </activity> 
     <activity 
      android:name=".Topic" 
      android:label="Tutorial Categories" > 
     </activity> 
     <activity 
      android:name=".ActivityNet" 
      android:label="Networking and Internet" > 
     </activity> 
     <activity 
      android:name=".Appear" 
      android:label="Windows 8 Customization Guide" > 
     </activity> 
     <activity 
      android:name=".HD" 
      android:label="Hardware and Drivers" > 
     </activity> 
     <activity 
      android:name=".Index" 
      android:label="Windows 8 Master Index" > 
     </activity> 
     <activity 
      android:name=".Inter" 
      android:label="Networking Articles" > 
     </activity> 
     <activity 
      android:name=".Short" 
      android:label="Shortcut and Context Menu" > 
     </activity> 
     <activity 
      android:name=".StartSc" 
      android:label="Taskbar and Start Screen" > 
     </activity> 
     <activity 
      android:name=".Tab" 
      android:label="Windows 8 Tablet" > 
     </activity> 
     <activity 
      android:name=".UA" 
      android:label="Windows 8 User Account" > 
     </activity> 
     <activity 
      android:name=".Update" 
      android:label="Windows 8 Updates and Gadgets" > 
     </activity> 
     <activity 
      android:name=".WinTheme" 
      android:label="Windows 8 Themes" > 
     </activity> 
     <activity 
      android:name=".MainActivity1" 
      android:label="System and Security" > 
     </activity> 
     <activity 
      android:name="com.google.ads.AdActivity" 
      android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" /> 
    </application> 

</manifest> 
+0

처럼 그들을 추가하여 다른 실제 장치? – Ahmad

+0

테스트 모드로 들어가는 방법을 명확하게 설명한 https://developers.google.com/mobile-ads-sdk/docs/admob/fundamentals을 검토합니다. –

답변

2

당신의 AdView으로 xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"을 넣고 당신의 ListView에서 제거에게 있습니다 :

여기 내 주요 XML 파일입니다. (아래 참조) 프로젝트를 청소하는 것을 잊지 마십시오.

또한 LinearLayout에서 xmlns:android="http://schemas.android.com/apk/res/android"을 제거하십시오.

광고를 표시하지 못하는 충분한 공간을 제공하지 않았기 때문에 광고가 보이지 않으며이 메시지가 표시되어야합니다.

광고 : (363) 광고를 표시 할 공간이 충분하지 않습니다. 싶어 : < 480, 75>이 있습니다 < 390, 1073741823>

이 광고를보고 더 많은 공간을 제공하기 위해. testDevices XML 필드를 사용하여, 당신은 위의이 볼 수있는이

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/ScrollView01" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:paddingBottom="30dip" 
     android:paddingTop="30dip" > 

     <com.google.ads.AdView 
      xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
      android:id="@+id/adView1" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      ads:adSize="BANNER" 
      ads:adUnitId="Your Admob ID" 
      ads:loadAdOnCreate="true" 
      ads:testDevices="TEST_EMULATOR" /> 

     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" 
      android:padding="30dip" > 

      <!-- Your TextView and Buttons go here --> 

     </LinearLayout> 
    </LinearLayout> 
</ScrollView> 

뭔가를 시도하지만 에뮬레이터에서 테스트 모드에 넣어.

<com.google.ads.AdView 
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
    android:id="@+id/adView1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    ads:adSize="BANNER" 
    ads:adUnitId="your id" 
    ads:testDevices="TEST_EMULATOR" 
    ads:loadAdOnCreate="true" /> 

실제 장치를 추가하고 컴퓨터에 휴대 전화를 연결하고 휴대 전화에서 응용 프로그램을 실행하십시오. LogCat에 전화 ID가 표시됩니다. 녹색으로 뭔가 말할 것인가?

당신이 할 수있는 광고는 오류 또는 경고를 받고 수행이

ads:testDevices="TEST_EMULATOR, 123356r6xcfgxtysd, 456r4y6rfghghsfgd" 
+0

내 xml 파일을 수정합니다. (내 질문에 코드를 업데이트했습니다). 그러나 운이 없다. .. 아직도 같은 문제에 직면 해있다. 한 가지, manifest.xml에서 을 제거하면 배너에 경고가 표시됩니다. 그래서 내 광고 게재 위치가 정상이라고 생각합니다. 그렇지 않으면 배너 내에서 경고를 볼 수 없습니다. –

+0

내 대답이 업데이트되었습니다. 광고를 게재하기에 충분한 폭을 제공하지 않았습니다. 게시 된 수정 된 XML을 살펴보고 지금 광고를보아야합니다. – Kirk

관련 문제