简体   繁体   English

错误:找不到资源整数/ google_play_services_version(又名app:integer / google_play_services_version)

[英]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 我的Android工作室版本是Android Studio 3.1.4

When I add following library in build.gradle(Model: app) this error will occurred. 当我在build.gradle(Model:app)中添加以下库时,将发生此错误。

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 ... \\程序\\编译\\ \\中间体舱单\\全\\调试\\ 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. 谢谢。

I had the same issue. 我遇到过同样的问题。 Add the Play Services library in your app gradle file. 在应用程序gradle文件中添加Play服务库。 implementation 'com.google.android.gms:play-services:9.2.1' or a later version. 实现'com.google.android.gms:play-services:9.2.1'或更高版本。 Then rebuild. 然后重建。

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 最后确保在build.gradle中添加Google服务插件和类路径

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 这将忽略谷歌服务与项目中任何其他库的冲突

None of the solutions helped me , 没有一个解决方案帮助了我,

Clearing the cache did . 清除缓存了。 thanks to How to clear gradle cache? 感谢如何清除gradle缓存?

I cleared the cache using this command: 我使用此命令清除了缓存:

rm -rf $HOME/.gradle/caches/

also I cleared the build dir running 我也清除了构建目录

./gradlew cleanBuildCache

and manually deleted the build dir 并手动删除了构建目录

the I did run assable again and the apk got generated OK worked :) 我确实再次运行assable和apk生成OK工作:)

./gradlew assemble

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android:找不到Admob资源@ integer / google_play_services_version - Android: Admob resource not found @integer/google_play_services_version 找不到Android清单@ integer / google_play_services_version - Android manifest @integer/google_play_services_version not found 如何修复“找不到与给定名称匹配的资源(&#39;value&#39;与值&#39;@ integer / google_play_services_version&#39;)” - How to fix “No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version')” No Gradle - 找不到与给定名称匹配的资源(&#39;value&#39;的值为&#39;@ integer / google_play_services_version&#39;) - No Gradle - No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version') 找不到与给定名称匹配的资源(在“值”处与值“ @ integer / google_play_services_version”) - No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version') 找不到google_play_services_version - google_play_services_version not found 对于intellij,无法解析符号@ integer / google_play_services_version - Cannot resolve symbol @integer/google_play_services_version for intellij 在Android Eclipse中出现错误“找不到与给定名称匹配的资源(在&#39;value&#39;值&#39;@integer/google_play_services_version&#39;)” - Getting error "No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version')" in Android Eclipse 我收到“错误:找不到与给定名称匹配的资源(值为@integer/google_play_services_version)” - I'm getting "Error: No resource found that matches the given name (at value with value @integer/google_play_services_version)" google_play_services_version)。 错误:处理失败 - google_play_services_version) not found. error: failed process
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM