0

I'm trying one of the example for Push notifications in android App with API 19. Here is my AndroidManifest.xml file:

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

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

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="com.example.jsonclient.permission.C2D_MESSAGE" />
````    <permission
        android:name="com.example.jsonclient.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".HomeActivity"
            android:label="@string/title_activity_home" >
        </activity>

        <receiver
            android:name=".GcmBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />

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

        <service android:name=".GcmIntentService" />
    </application>

</manifest>

Here I added Google Play Services library : enter image description here

enter image description here

Here is my SDK Manager with Google Play Services. enter image description here When executing method

checkPlayServices

I got Error :

The Google Play services resources were not Found. Check your project configuration to ensure that the resources are included.

Ashok
  • 601
  • 1
  • 17
  • 32
  • unless im missing it you dont have the required `meta-data` tag that indicated the version of google play service in your manifest – tyczj Aug 03 '15 at 18:17
  • you mean I have to add this: – Ashok Aug 03 '15 at 18:26
  • with that I see Error: : No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version'). – Ashok Aug 03 '15 at 18:40

2 Answers2

2

Go to android-sdk folder in your system then extras->google->google_play_services->libproject-> google-play-services_lib

Import google-play-services_lib in your workspace and then add this library project to your own project. Your issue will be hopefully resolved.

Aakash
  • 5,181
  • 5
  • 20
  • 37
  • I have already added Google play service jar, isn't the same ? – Ashok Aug 03 '15 at 18:32
  • You need to add this library to your project or eclipse is unable to find the required resources. – Aakash Aug 03 '15 at 18:35
  • I have added this, But how can I check this is added ? in Eclipse – Ashok Aug 03 '15 at 19:02
  • try running your project, if you don't get the error you were getting previously, that means ,google play service is added. Also you have to add library to your project by going to properties->Android-> Click on add->Select google-play-services_lib and done. – Aakash Aug 03 '15 at 19:06
  • Thanks Aakash thats worhing, But Accidentally I choose extras->google->google_play_services->libproject-> google-play-services_lib while importing and Google doc says you need to copy and import that source. I tried to remove it and point to copied one, but its not taking as same library name is already stored somewhere! How can I point to new library path ? – Ashok Aug 04 '15 at 05:31
1

You cannot only import the .jar file, you need to import the entire library which includes all its resource files.

Please read the documentation on how to setup google play services.

https://developers.google.com/android/guides/setup

Also eclipse is no longer supported move to Android Studio and things will be a lot easier when importing google play services

tyczj
  • 71,600
  • 54
  • 194
  • 296