Android 找不到Google Play服务
当尝试启动包含通知的活动时,我收到以下logcat异常:Android 找不到Google Play服务,android,google-play,manifest,ads,Android,Google Play,Manifest,Ads,当尝试启动包含通知的活动时,我收到以下logcat异常: 02-26 16:02:29.766: E/GooglePlayServicesUtil(26683): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included. 我以编程方式创建了AdView(没有xml文件),如下所示: public cl
02-26 16:02:29.766: E/GooglePlayServicesUtil(26683): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
我以编程方式创建了AdView(没有xml文件),如下所示:
public class StartActivity extends Activity {
private AdView adView;
private RelativeLayout relativeLayout;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start);
adView = new AdView(this);
adView.setAdUnitId("xxx");
adView.setAdSize(AdSize.SMART_BANNER);
relativeLayout = (RelativeLayout)findViewById(R.id.activity_start);
relativeLayout.addView(adView);
AdRequest.Builder adRequest = new AdRequest.Builder();
adRequest.addTestDevice("018eb6f8");
adView.loadAd(adRequest.build());
}
}
这就是我包含adview的活动的样子
我的清单文件如下所示(删除了其他不相关的活动):
如您所见,我已将google play服务库导入eclipse:
在这里你可以看到我把它和我的项目联系起来了:
有什么想法吗?您会遇到这个错误,因为您必须将Google Play服务项目链接到您的项目。您可以通过以下方式复制Google Play services项目: …\android sdk文件夹\extras\google\google\u play\u服务
将此项目导入Eclipse,并将其作为标签添加到项目的构建路径中。您使用的是仿真器还是实际设备?@dymmeh我使用的是实际的Phonehmm,如果您要求,google.com会返回什么?问google是什么意思?我已经将google play services库导入eclipse,并将其添加到我的应用程序的构建路径中。。。
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="19" />
<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.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>