2016-11-08 17 views
0

私のアプリケーションに広告を追加しようとしています。不幸にも、私が調べたすべてのものは、特定のバージョンの前に移動したフォルダがあるため、手助けできませんでした。私はGoogle Playサービスをインストールしています。私は何かが不足しているかどうかはわかりません。私はplay_services_ads_liteフォルダに移動してそこからjarファイルをインポートして、私がやったことを信じる必要があると言っている一見を読んだ。しかし、私はこれは私のmanfestGoogle Playサービスのバージョンでエラーが発生しました

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

<uses-sdk 
    android:minSdkVersion="16" 
    android:targetSdkVersion="21" /> 

<application 
    android:allowBackup="true" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
      <activity 
    android:name="com.google.android.gms.ads.AdActivity" 
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> 

    <meta-data android:name="com.google.android.gms.version" 
      android:value="@integer/google_play_services_version"/> 
    <activity 
     android:name=".MainActivity" 
     android:screenOrientation="portrait" 
     android:label="@string/app_name" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 

    </activity> 

</application> 

と、これは私の主な活動

<android.support.v4.widget.DrawerLayout  xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="com.example.coursebook.MainActivity" > 

<ScrollView 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/scroll" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
<LinearLayout 
    android:id="@+id/container" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" > 
    </LinearLayout> 

</ScrollView> 


<fragment 
    android:id="@+id/navigation_drawer" 
    android:name="com.example.coursebook.NavigationDrawerFragment" 
    android:layout_width="@dimen/navigation_drawer_width" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    tools:layout="@layout/fragment_navigation_drawer" /> 

<com.google.android.gms.ads.AdView 
     android:id="@+id/adView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_alignParentBottom="true" 
     ads:adSize="BANNER" 
     ads:adUnitId="cxxxxxxxxxxxxxxxxxxx">  
     </com.google.android.gms.ads.AdView> 
</android.support.v4.widget.DrawerLayout> 
+0

あなたはAndroidスタジオを使用していますか?そうした場合、あなたのgradle依存関係に 'com.google.android.gms:play-services-ads:9.8.0'を含めてください。 –

+0

いいえ私はEclipseを使用しています – Ian

+0

Eclipseは現在、Gradleの依存関係をサポートしています –

答えて

1

があなたのGradleを追加である

"@整数/ google_play_services_version" で見つかりませリソースをrecivivngん保ちます

dependencies { 
    compile 'com.google.android.gms:play-services:9.8.0' 
} 

Add Google Play Services to Your Projectプロジェクトで実行されたすべての手順を一度チェックします。

+0

これはGradleとおそらくAndroid Studioの使用を前提としていますか? Eclipseを使用して –

+0

イアン –

関連する問題