1

andengineでAndroidゲームを作成し、AdMob広告をゲームに追加したいのですが、以下のコードを使用しました。画像のエラーが発生しました。http://s16.postimage.org/rz6fbr2l1/Untitled.png

 <activity android:name="com.google.ads.AdActivity"
          android:configChanges="keyboard|keyboardHidden|orientation"/>

しかし、私は上記のようにマニフェストに追加しました。

 protected void onSetContentView() {


     final FrameLayout frameLayout = new FrameLayout(this);
     final FrameLayout.LayoutParams frameLayoutLayoutParams =
             new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT,
                                          FrameLayout.LayoutParams.FILL_PARENT);

     final AdView adView = new AdView(this, AdSize.BANNER, "PUBLISHER_ID");

     adView.refreshDrawableState();
     adView.setVisibility(AdView.VISIBLE);
     final FrameLayout.LayoutParams adViewLayoutParams =
             new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
                                          FrameLayout.LayoutParams.WRAP_CONTENT,
                                          Gravity.CENTER_HORIZONTAL|Gravity.TOP);


     AdRequest adRequest = new AdRequest();
     adView.loadAd(adRequest);

     this.mRenderSurfaceView = new RenderSurfaceView(this);
     mRenderSurfaceView.setRenderer(mEngine);

     final android.widget.FrameLayout.LayoutParams surfaceViewLayoutParams =
             new FrameLayout.LayoutParams(super.createSurfaceViewLayoutParams());

     frameLayout.addView(this.mRenderSurfaceView, surfaceViewLayoutParams);
     frameLayout.addView(adView, adViewLayoutParams);

     this.setContentView(frameLayout, frameLayoutLayoutParams);
 }
4

0 に答える 0