找不到com.google.ads.AdActivity [英] Could not find com.google.ads.AdActivity

查看:142
本文介绍了找不到com.google.ads.AdActivity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

![请在此输入图片说明] [1]

^ 还有就是像让你知道我使用SDK 3.2。还有更多的这种code,但基本上这是家居里面我主要的一个我的Java code,它不会加载我的广告,当我去加载它们。有没有错误,没有在我的main.xml中的基本上的广告没有显示在所有

广告

 进口com.google.ads.AdRequest;
     进口com.google.ads.AdSize;
     进口com.google.ads.AdView;



     公共类LearningLettersActivity扩展活动

         私人AD浏览报AD浏览报;


         @覆盖
         公共无效的onCreate(包savedInstanceState){
             super.onCreate(savedInstanceState);
             的setContentView(R.layout.main);


         //创建AD浏览报
         AD浏览报=新的AD浏览报(这一点,AdSize.BANNER,aXXXXXXXXXXXXXXXX); //< ---我的出版商标识有
         //查找您的LinearLayout假设它是被赋予了
         //属性机器人:ID =@ + ID / mainLayout\
         的LinearLayout布局=(的LinearLayout)findViewById(R.id.mainLayout);
         // AD浏览报给它添加
         layout.addView(AD浏览报);
         //初始化一个通用的请求与广告加载
         adView.loadAd(新AdRequest());
 

下面是我的清单

 < XML版本=1.0编码=UTF-8&GT?;
   <舱单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
                 包=com.better.work.learning.letters.and.more
                 安卓版code =3
                 机器人:VERSIONNAME =1.00>
         <应用
                 机器人:图标=@可绘制/图标
                 机器人:标签=@字符串/ APP_NAME>
             <活动
                     机器人:名称=。LearningLettersActivity
                     机器人:标签=@字符串/ APP_NAME
                     机器人:screenOrientation =景观与GT;
                 <意向滤光器>
                     <作用机器人:名称=android.intent.action.MAIN/>
                     <类机器人:名称=android.intent.category.LAUNCHER/>
                 &所述; /意图滤光器>
             < /活性GT;
             <活动机器人:名称=com.google.ads.AdActivity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
         < /用途>
         <使用-权限的Andr​​oid:名称=android.permission.INTERNET对/>
         <使用-权限的Andr​​oid:名称=android.permission.ACCESS_NETWORK_STATE/>
         <使用-SDK安卓的minSdkVersion =4/>
     < /舱单>
 

基本上没有什么拉的为我的广告在所有当我去到我的手机上测试它,我尝试使用以下,仍然没有在code。

  AdRequest adrequest =新AdRequest();
     adrequest.setTesting(真正的);
     adView.loadAd(adrequest);
 

我也试过:

  AdRequest adrequest =新AdRequest();
     adrequest.setTesting(真正的);
     adrequest.setTestingDevices(HT0CWHL11423)//< ---加载仿真器选项卡中我的手机,当我去显示的名字
     adView.loadAd(adrequest);


    3月1日至18号:50:19.874:E /广告(16938):找不到com.google.ads.AdActivity,请确保它是注册在AndroidManifest.xml中。
    3月1日至18号:50:19.874:E /广告(16938):你必须有AdActivity在AndroidManifest.xml中声明与configChanges。
 

解决方案

期待中的logcat中与​​标记广告东西。具体而言,寻找一些这样的:

  

广告请求成功,但没有返回的广告,由于库存不足。

这可能是你没有得到广告回来,因为AdMob的可以不填广告。

有几件事情需要注意。 AdRequest.setTesting(真),它只是用来设置测试模式仿真器,是pcated赞成 AdRequest.addTestDevice的德$ P $(AdRequest .TEST_EMULATOR)设置测试模式上的仿真器。对于设置一个试验装置,设备ID,你都应该进入一个哈希设备ID,您可以在logcat的发现,以及如果你正在调试设备上。

最后,您使用的是显示你的SDK包含了ButtonMasher应用程序的图片,而是code您提供看起来就像是一个字母学习应用程序。确保你确实使用4.3.1在此应用程序。

![enter image description here][1]

^ there is the image so you know I'm using sdk 3.2. There is more to this code, but basically this is everything for my java code inside my main one, and it doesn't load my ads when I go to load them. There are no errors and nothing in my Main.XML for the ad Basically the ad is not showing at all

     import com.google.ads.AdRequest;
     import com.google.ads.AdSize;
     import com.google.ads.AdView;



     public class LearningLettersActivity extends Activity

         private AdView adView;


         @Override
         public void onCreate(Bundle savedInstanceState) {
             super.onCreate(savedInstanceState);
             setContentView(R.layout.main);


         // Create the adView    
         adView = new AdView(this, AdSize.BANNER, "aXXXXXXXXXXXXXXXX); //<---My   Publisher Id there"    
         // Lookup your LinearLayout assuming it’s been given    
         // the attribute android:id="@+id/mainLayout"    \
         LinearLayout layout = (LinearLayout)findViewById(R.id.mainLayout);   
         // Add the adView to it   
         layout.addView(adView);  
         // Initiate a generic request to load it with an ad   
         adView.loadAd(new AdRequest()); 

Here is my manifest

   <?xml version="1.0" encoding="utf-8"?>
   <manifest xmlns:android="http://schemas.android.com/apk/res/android"
                 package="com.better.work.learning.letters.and.more"
                 android:versionCode="3"
                 android:versionName="1.00" >
         <application
                 android:icon="@drawable/icon"
                 android:label="@string/app_name" >
             <activity
                     android:name=".LearningLettersActivity"
                     android:label="@string/app_name" 
                     android:screenOrientation="landscape" >
                 <intent-filter>
                     <action android:name="android.intent.action.MAIN" />
                     <category android:name="android.intent.category.LAUNCHER" />
                 </intent-filter>
             </activity>
             <activity android:name="com.google.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"/>
         <uses-sdk  android:minSdkVersion="4"/>
     </manifest>            

Basically nothing is pooping up for my ads at all when I go to test it on my phone, I tried using the code below and still nothing.

     AdRequest adrequest = new AdRequest();
     adrequest.setTesting (true);
     adView.loadAd(adrequest);

I've also tried:

     AdRequest adrequest = new AdRequest();
     adrequest.setTesting (true);
     adrequest.setTestingDevices("HT0CWHL11423") //<--- the name of my phone that appears when I go to load the emulator tab
     adView.loadAd(adrequest);  


    01-18 03:50:19.874: E/Ads(16938): Could not find com.google.ads.AdActivity, please make sure it is registered in AndroidManifest.xml.
    01-18 03:50:19.874: E/Ads(16938): You must have AdActivity declared in AndroidManifest.xml with configChanges.

解决方案

Look in the logcat for anything with the Tag Ads. Specifically, look for something like:

Ad Request successful, but no ad returned due to lack of inventory.

It is possible that you are not getting ads back because AdMob cannot fill an ad.

There are a couple of things to note here. AdRequest.setTesting(true), which only used to set test mode for emulators, is deprecated in favor of AdRequest.addTestDevice(AdRequest.TEST_EMULATOR) for setting test mode on an emulator. For setting a test device, the device id you are supposed to enter is a hashed device id, which you can find in the logcat as well if you are debugging on your device.

Finally, the picture that you're using shows you have the SDK included for a ButtonMasher app, but the code you provided looks like it's for a Letter Learning app. Make sure you are indeed using 4.3.1 in this app.

这篇关于找不到com.google.ads.AdActivity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆