Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android – 缺少必需的XML属性“adSize”大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
当我启动我的应用程序时,我得到一个“必需的 XML属性”adSize“丢失”这是写在我的智能手机的屏幕上,而不是我的横幅.我尝试建立在堆栈上的不同解决方案(如xmlns:ads =“http://scheR_16_11845@as.android.com/apk/res-auto”而不是xmlns:ads =“http://scheR_16_11845@as.android.com/apk/ libs / com.google.ads“,而不是xmlns:ads =”http://scheR_16_11845@as.android.com/apk/lib/com.google.ads“),但没有人工作… @H_404_2@这是我的java代码(一个简单的Hello World只是试图实现一个横幅):
package com.example.publicite;

import android.os.bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

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

@Override
public Boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main,menu);
    return true;
}

}

这是我的xml文件

<RelativeLayout 
xmlns:android="http://scheR_16_11845@as.android.com/apk/res/android"
xmlns:tools="http://scheR_16_11845@as.android.com/tools"
xmlns:ads="http://scheR_16_11845@as.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@String/Hello_world" />

<com.google.android.gms.ads.AdView
    xmlns:ads="http://scheR_16_11845@as.android.com/apk/libs/com.google.ads"
    android:id="@+id/adView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    ads:adSize="BAnnER"
    ads:adUnitId="MyAdUnitId"
    ads:loadAdOnCreate="true"
    ads:testDevices="test_EMULATOR" />

<Button
    android:id="@+id/votrescore"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="..." />

这是我的清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://scheR_16_11845@as.android.com/apk/res/android"
package="com.example.publicite"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="13"
    android:targetSdkVersion="13" />

<application
    android:allowBACkup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@String/app_name"
    android:theme="@style/AppTheme" >

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

    <activity
        android:name="com.example.publicite.MainActivity"
        android:label="@String/app_name" >
        <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" />

我使用谷歌播放服务lib.@H_404_2@谢谢.

解决方法

这是一个奇怪的答案.我刚刚重启了我的日食,盯着工作.这可能有助于一些.

只需重新启动eclipse或android studio

大佬总结

以上是大佬教程为你收集整理的android – 缺少必需的XML属性“adSize”全部内容,希望文章能够帮你解决android – 缺少必需的XML属性“adSize”所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。