元素< com.google.android.gms.ads.AdView>不明 [英] element <com.google.android.gms.ads.AdView> is unknown

查看:217
本文介绍了元素< com.google.android.gms.ads.AdView>不明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想广告小怪广告加入到我已经安装了谷歌播放服务包17我的Andr​​oid应用程序,并从SDK复制的包>其它>谷歌>谷歌播放服务,以我的工作空间>的myproject> lib目录> __和谷歌播放-service_lib文件导入到我的工作区。
之后我加入谷歌,播放service.jar中我的项目> Java构建路径>库和我还检查了订单和出口。

I'm trying to add ad-mobs ads into my android application I've installed Google play services 17 package and copied the package from the sdk>extras>google>google play service to my work space>myproject>lib>__ and imported the google-play-service_lib file to my workspace. after that I added google-play-service.jar to my project>java build path >libraries and I also checked order and export.

不过是徒劳,我main.xml中的元素com.google.andriod.gsm.ads.AdView得到一个错误是未知的,但它编译并启动在仿真器的活性,但有一个运行时错误。

But in vain I'm getting an error in main.xml for Element com.google.andriod.gsm.ads.AdView is unknown but it compiles and launches the activity in emluator but has an runtime error.

我已经经历了这么多的帖子不见了,但没有确实让我不够清晰。

I've gone through so many posts but none did make me clear enough.

下面下面是我的项目的mainfest:

Here below is the mainfest of my project:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.SAI.banner"
android:versionCode="1"
android:versionName="1.0" >

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

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


<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.SAI.banner.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>

</manifest>

main.xml中:

Main.xml :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.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"
android:background="@drawable/bg"
tools:context="com.SAI.banner.MainActivity$PlaceholderFragment" >

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="20dp"
    android:text="@string/hello_world" />

<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textView1"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="60dp"
    ads:adSize="BANNER"
    ads:adUnitId="ca-app-pub-3131326757457805/934xxxxxxx" >
</com.google.android.gms.ads.AdView>

</RelativeLayout>

该MainActivity.java

The MainActivity.java

package com.SAI.banner;

import android.support.v7.app.ActionBarActivity;
import com.google.android.gms.ads.*;
import android.os.Bundle;

public class MainActivity extends ActionBarActivity {

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

    // Look up the AdView as a resource and load a request.
    AdView adView = (AdView)this.findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    adView.loadAd(adRequest);
}
}

在此先感谢Saikiran。
请帮我解决这个问题。

Thanks in advance Saikiran. Please help me to solve this.

推荐答案

我有这个问题。当我用下面的步骤加入谷歌播放服务我的问题解决了:

I had this problem. My problem was solved when I added the google play services with following steps:


  1. 导入谷歌Play服务,因为项目。不要忘记检查项目复制到工作区选项

  2. 右键点击您的应用程序的项目,然后单击属性。选择Android系统。点击添加库。谷歌选择从播放列表中的服务。

  3. 您应该确保您删除JAR如果你有包括previously。

  4. 清洁你的项目,然后重新建立。

这篇关于元素&lt; com.google.android.gms.ads.AdView&GT;不明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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