简体   繁体   中英

Error with google play services version

I am trying to add ads to my application. Unfortunatly everything i have looked up has been unable to help because it is before a certain version where the moved folders around. I do have google play services installed. I am unsure if i am missing something. I have read somethings saying i need to go to the play_services_ads_lite folder and import jar files from there which i believe i have done as well. However i keep recivivng a no resources found with "@integer/google_play_services_version"

This is my manfest

<?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>

and this is my main activity

<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>

add your gradle

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

Add Google Play Services to Your Project check once all the steps done in your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM