机器人的AdMob找不到类 [英] android adMob could not find class

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

问题描述

启动时

AdMob的工作正常,直到我更新日食为最新版本,现在,报告错误,java.lang.NoClassDefFoundError的:com.google.ads.AdRequest。但AdMob的库连接到项目!!谢谢。

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

        AdRequest adRequest =新AdRequest();
        adRequest.addTestDevice(AdRequest.TEST_EMULATOR); //模拟器
        adRequest.addTestDevice(3xxxxxxxxxx);

        AD浏览报AD浏览报=新的AD浏览报(这一点,AdSize.BANNER,axxxxxxxxxx);

        的LinearLayout布局=(的LinearLayout)findViewById(R.id.mainLayout);

        layout.addView(AD浏览报);

        adView.loadAd(新AdRequest());
    }
 

和适当的参考和清单的权限

 <活动机器人:名称=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/>
 

解决方案

请确保您的.jar文件的属性被检查 - > Java构建路径 - >订单和出口

adMob was working fine until I update eclipse to latest version, now when starting, an error is reported, java.lang.NoClassDefFoundError: com.google.ads.AdRequest. But adMob library is attached to the project!! Thank you.

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

        AdRequest adRequest = new AdRequest();
        adRequest.addTestDevice(AdRequest.TEST_EMULATOR);               // Emulator
        adRequest.addTestDevice("3xxxxxxxxxx");  

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

        LinearLayout layout = (LinearLayout)findViewById(R.id.mainLayout);

        layout.addView(adView);

        adView.loadAd(new AdRequest());
    }

and proper reference and permissions on manifest

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

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

解决方案

Make sure your .jar files are checked in Properties --> Java Build Path --> Order and Export.

这篇关于机器人的AdMob找不到类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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