Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: resource integer/google_play_services_version (aka app:integer/google_play_services_version) not found

Getting error while compile or run the project. I want to calculate the distance which I traveled. My Android studio version is Android Studio 3.1.4

When I add following library in build.gradle(Model: app) this error will occurred.

implementation 'com.google.android.gms:play-services-location:12.0.1'

Error is getting in following file :

...\app\build\intermediates\manifests\full\debug\AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="shravan.measuredistance.app"
android:targetSandboxVersion="2"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="15"
    android:targetSdkVersion="26" />

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

<application
    android:name="android.support.multidex.MultiDexApplication"
    android:allowBackup="true"
    android:debuggable="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:testOnly="true"
    android:theme="@style/AppTheme" >
    <meta-data
        android:name="aia-compat-api-min-version"
        android:value="1" />
    <meta-data
        android:name="android.support.VERSION"
        android:value="26.1.0" />
    <meta-data
        android:name="android.arch.lifecycle.VERSION"
        android:value="27.0.0-SNAPSHOT" />

    <activity
        android:name="shravan.measuredistance.distance.MainActivity"
        android:splitName="distance" >
        <intent-filter android:order="1" >
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />

            <data
                android:host="www.atjoin.in"
                android:pathPattern="/.*"
                android:scheme="https" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <service
        android:name="shravan.measuredistance.distance.LocationService"
        android:splitName="distance" />

    <activity
        android:name="com.google.android.gms.common.api.GoogleApiActivity"
        android:exported="false"
        android:splitName="distance"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" />

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

Please give me suggestion for this. Thanks.

like image 667
Shravan Avatar asked Aug 25 '18 06:08

Shravan


2 Answers

I had the same issue. Add the Play Services library in your app gradle file. implementation 'com.google.android.gms:play-services:9.2.1' or a later version. Then rebuild.

like image 129
Osoro Avatar answered Oct 30 '22 19:10

Osoro


Add this to your manifest before your package name

xmlns:tools="http://schemas.android.com/tools"

Also add the code below in your manifest after

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

Final make sure your add Google services plugin and class path in your build.gradle

apply plugin: 'com.google.gms.google-services' (add to module)
classpath 'com.google.gms:google-services:4.0.1' (add to project)

This will ignore the clashing of google services with any other library in your project

like image 1
Yusuf Adefolahan Avatar answered Oct 30 '22 18:10

Yusuf Adefolahan