2014-03-14 3 views
0

안녕하세요. 여기 내 처음으로 앱을 개발하는 게시자입니다.Android Google Play 서비스 광고가 표시되지 않음

Google 서비스를 작동시키는 데 문제가 있습니다. 마침내 모든 코드가 오류가 발생하지 않고 앱이 내 휴대 전화에로드됩니다. 그러나 지금로드 할 때 내 앱 이름 위에 내 앱 위에 배너가 표시됩니다.

package com.TylerGibson.MopeyMacaw; 

import com.google.android.gms.ads.*; 
import android.os.Bundle; 

//import com.kilobolt.MopeyMacaw.R; 
import com.badlogic.gdx.backends.android.AndroidApplication; 
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; 
import com.kilobolt.ZombieBird.ZBGame; 

public class MainActivity extends AndroidApplication { 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     setContentView(R.layout.main); 

     // Look up the AdView as a resource and load a request. 
     AdView adView = (AdView)this.findViewById(R.id.adView); 
     AdRequest adRequest = new AdRequest.Builder().build(); 
     adView.loadAd(adRequest); 



     super.onCreate(savedInstanceState); 

     AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); 
     cfg.useGL20 = false; 

     initialize(new ZBGame(), cfg); 


    } 
} 

다음은 매니페스트 내 주요

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 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" 
       android:orientation="vertical" 
       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:adSize="BANNER" 
     ads:adUnitId="ca-app-pub-4445204025228818/4791459284" > 
    </com.google.android.gms.ads.AdView> 

</LinearLayout> 

안드로이드

<?xml version="1.0" encoding="utf-8"?> 

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.TylerGibson.MopeyMacaw" 
    android:versionCode="4" 
    android:versionName="1.0" > 
    <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="19" /> 
    <application 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" > 
     <meta-data android:name="com.google.android.gms.version" 
       android:value="@integer/google_play_services_version"/> 
     <activity android:name="com.TylerGibson.MopeyMacaw.MainActivity" 
      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"/> 
    </application> 
    <uses-permission android:name="android.permission.INTERNET"/> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
</manifest> 

(캔트 포스트 이미지) 당신이 내가 넣어 이후 최고 지속적으로 이제까지 표시까지 볼 수있는 아이콘과 "에디 머피 꼬" ads/google-services 코드에 이 문제를 해결하고 광고를 작동 시키려면 어떻게해야합니까? 미리 감사드립니다.

+0

나는 약간의 변경을가했고 아래의 코드를 Initialize 문 아래에 두었다. 이제 광고를 얻지 만 광고가 검은 색 화면에 표시되고 아무 것도 발생하지 않습니다. 앱을 볼 수 없습니다. 초기화 (새 ZBGame(), cfg); setContentView (R.layout.main); // AdView를 리소스로 검색하고 요청을로드합니다. AdView adView = (AdView) this.findViewById (R.id.adView); AdRequest adRequest = new AdRequest.Builder(). build(); adView.loadAd (adRequest); – Spartanias

답변

0

AdView는 대소 문자를 구분합니다. R.id.adView와 AdView 인 XML에 할당 된 ID를 확인하십시오.

관련 문제