【发布时间】:2014-08-15 18:38:07
【问题描述】:
我刚刚清理了安装的 Android 开发工具 (ADT),但无法让 Google Play 服务正常工作;更具体地说,我无法通过布局预览来实例化 adView BANNER。
将最新的 GPS 库导入我的工作区(从 sdk/extras/Google/google-play-services 复制到工作区)
右键项目>属性>android选项卡>将GPS库添加到项目
在我的项目清单中添加了以下内容:
外面<application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
内部<application>
<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"/>
Minium sdk 设置为"9"
目标"21"
在我的布局文件中:
<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"
tools:context="${relativePackage}.${activityClass}" >
<com.google.android.gms.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="my ad id as stated on apps.admob.com"
ads:adSize="BANNER"/>
在图形布局窗格中,出现错误
The following classes could not be instantiated:
- com.google.android.gms.ads.AdView
我是不是忘记了什么?我在某处犯了错误吗?任何人都对如何解决此问题有任何想法>
谢谢!
【问题讨论】:
-
另请注意:在我的安卓设备上运行应用程序时,广告可以正常工作;只有预览不能正常工作
标签: android eclipse google-play-services