2014-04-01 85 views
0

我下載了https://codeload.github.com/googleads/googleads-mobile-android-examples/zip/master它有一個移動廣告示例應用程序。我導入了項目工作區從他們的樣品通過單擊導入 - >現有workspace.The問題的Android代碼的應用程序停止工作時,在仿真器與Android版本上運行3.0 這裏是我的logcatGoogle play服務廣告sdk無效?

03-31 20:41:21.601: E/GooglePlayServicesUtil(525): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included. 
03-31 20:41:21.742: E/AndroidRuntime(525): FATAL EXCEPTION: main 
03-31 20:41:21.742: E/AndroidRuntime(525): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.example.gms.ads.banner/com.google.example.gms.ads.banner.BannerSample}: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist. You must have the following declaration within the <application> element:  <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> 
03-31 20:41:21.742: E/AndroidRuntime(525): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1736) 
03-31 20:41:21.742: E/AndroidRuntime(525): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752) 
03-31 20:41:21.742: E/AndroidRuntime(525): at android.app.ActivityThread.access$1500(ActivityThread.java:123) 
03-31 20:41:21.742: E/AndroidRuntime(525): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993) 
03-31 20:41:21.742: E/AndroidRuntime(525): at android.os.Handler.dispatchMessage(Handler.java:99) 
03-31 20:41:21.742: E/AndroidRuntime(525): at android.os.Looper.loop(Looper.java:126) 
03-31 20:41:21.742: E/AndroidRuntime(525): at android.app.ActivityThread.main(ActivityThread.java:3997) 
03-31 20:41:21.742: E/AndroidRuntime(525): at java.lang.reflect.Method.invokeNative(Native Method) 
03-31 20:41:21.742: E/AndroidRuntime(525): at java.lang.reflect.Method.invoke(Method.java:491) 
03-31 20:41:21.742: E/AndroidRuntime(525): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841) 
03-31 20:41:21.742: E/AndroidRuntime(525): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) 
03-31 20:41:21.742: E/AndroidRuntime(525): at dalvik.system.NativeStart.main(Native Method) 
03-31 20:41:21.742: E/AndroidRuntime(525): Caused by: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist. You must have the following declaration within the <application> element:  <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> 
03-31 20:41:21.742: E/AndroidRuntime(525): at com.google.android.gms.common.GooglePlayServicesUtil.t(Unknown Source) 
03-31 20:41:21.742: E/AndroidRuntime(525): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source) 
03-31 20:41:21.742: E/AndroidRuntime(525): at com.google.android.gms.internal.y.a(Unknown Source) 
03-31 20:41:21.742: E/AndroidRuntime(525): at com.google.android.gms.internal.ak.an(Unknown Source) 
03-31 20:41:21.742: E/AndroidRuntime(525): at com.google.android.gms.internal.ak.a(Unknown Source) 
03-31 20:41:21.742: E/AndroidRuntime(525): at com.google.android.gms.ads.AdView.loadAd(Unknown Source) 
03-31 20:41:21.742: E/AndroidRuntime(525): at com.google.example.gms.ads.banner.BannerSample.onCreate(BannerSample.java:45) 
03-31 20:41:21.742: E/AndroidRuntime(525): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048) 
03-31 20:41:21.742: E/AndroidRuntime(525): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700) 
03-31 20:41:21.742: E/AndroidRuntime(525): ... 11 more 

什麼是錯的這裏。我已導入谷歌播放services.jar

+0

http://stackoverflow.com/questions/21233306/startapp3dbanner-display-errer-in-android/21234371#21234371 – Amitsharma

回答

0

在您的Android清單文件中<application>標籤補充一點:

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

感謝。

+0

它存在那裏,但日食宣稱它是一個錯誤,所以我不得不刪除它。有沒有一步一步的教程,我可以按照使用谷歌播放服務在我的應用程序中集成廣告。我搜查了很多,但找不到一個。 – user3404195

+0

選中此:https://developers.google.com/mobile-ads-sdk/docs/ –

+0

@ user3404195:你檢查了鏈接嗎? –

0

1.請在Eclipse中導入Google Play服務庫項目(sdk \ extras \ google \ google_play_services)。

2.And添加本庫項目,以您的樣本項目(右鍵點擊你的項目得到了屬性 - > Android--添加庫)

3.Clean並生成項目。

我希望這工作正常。

+0

我已經這樣做了。 – user3404195

相關問題