當試圖啓動我的活動conatining的AD瀏覽我收到以下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 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的活動的樣子。
我的清單文件看起來像這樣(去除其他不相關的活動):
<?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>
,你可以看到我已經導入了谷歌播放 - 服務 - lib去日食:
,在這裏你可以看到我已經掛起來用我的項目:
任何想法?
您使用模擬器還是實際設備? – dymmeh
@dymmeh我正在使用我的實際手機 – user2410644
嗯,如果你問它google.com會返回什麼? – Selvin