未找到属性adSize在包资源标识符 [英] No resource identifier found for attribute adSize in package

查看:419
本文介绍了未找到属性adSize在包资源标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用程序中添加AdMob的广告。

在清单中,我有:

 <使用-权限的Andr​​oid:名称=android.permission.INTERNET对/>
    <使用-权限的Andr​​oid:名称=android.permission.ACCESS_NETWORK_STATE/>

<元数据的android:NAME =com.google.android.gms.version
        机器人:值=@整数/ google_play_services_version/>


<活动机器人:名称=com.google.android.gms.ads.AdActivity
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
            机器人:主题=@安卓风格/ Theme.Translucent/>
 

在XML活动的布局我使用:

 < com.google.android.gms.ads.AdView
        的xmlns:广告=htt​​p://schemas.android.com/apk/res-auto
        机器人:ID =@ + ID / AD浏览报
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_centerHorizo​​ntal =真
        机器人:layout_alignParentBottom =真
        广告:adSize =大旗
        广告:adUnitId =@字符串/ ID>
    < /com.google.android.gms.ads.AdView>
 

我的Java code的主要活动:

  @覆盖
    保护无效的onCreate(包savedInstanceState){
        super.onCreate(savedInstanceState);
        的setContentView(R.layout.activity_main);

       mAdView =(AD浏览报)findViewById(R.id.adView);
        。adRequest =新AdRequest.Builder()建();
        mAdView.loadAd(adRequest);
 

不幸的是,这并不工作,我收到此错误

  

错误:未找到属性adSize在包资源标识符

解决方案

确定我已经解决EXPORTING我的Eclipse项目导入机器人工作室 那么我就跟着GOOGLE指南[的https://developers.google.com/mobile-ads-sdk/docs/admob/android/interstitial][1]

有一点非常明确

I am trying to add AdMob ads in my application.

In the manifest I have:

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

<meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />


<activity android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
            android:theme="@android:style/Theme.Translucent" />

In the xml activity's layout I use:

<com.google.android.gms.ads.AdView
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true"
        ads:adSize="BANNER"
        ads:adUnitId="@string/id">
    </com.google.android.gms.ads.AdView>

My java code in the main activity:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

       mAdView = (AdView) findViewById(R.id.adView);
        adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);

Unfortunately this doesn't work and I receive this error

error: No resource identifier found for attribute 'adSize' in package

解决方案

OK I'VE SOLVED EXPORTING MY ECLIPSE PROJECT INTO ANDROID STUDIO THEN I'VE FOLLOWED THE GOOGLE GUIDE [https://developers.google.com/mobile-ads-sdk/docs/admob/android/interstitial][1]

IT'S VERY CLEAR

这篇关于未找到属性adSize在包资源标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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