java 无法为intellij解析符号@integer/google_play_services_version

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26070562/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 09:14:46  来源:igfitidea点击:

Cannot resolve symbol @integer/google_play_services_version for intellij

javaandroidxmlintellij-idea

提问by Patricia Rozario

AANot sure why this error is occuring... This is my AndroidManifest.xml file. I added in Google Play Services, Repository and Android Support Library. Not sure if i need another plug in or what

AA不确定为什么会发生此错误...这是我的 AndroidManifest.xml 文件。我添加了 Google Play 服务、存储库和 Android 支持库。不确定我是否需要另一个插件或什么

          <?xml version="1.0" encoding="utf-8"?>
            <manifest xmlns:android="http://schemas.android.com/apk/res/android"
                      package="com.example.RuMaps"
                      android:versionCode="1"
                      android:versionName="1.0">
                <uses-sdk android:minSdkVersion="20"/>
                <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
                    <activity android:name="MyActivity"
                              android:label="@string/app_name">
                        <intent-filter>
                            <action android:name="android.intent.action.MAIN"/>
                            <category android:name="android.intent.category.LAUNCHER"/>
                        </intent-filter>
                    </activity>

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

                    <meta-data
                            android:name="com.google.android.maps.v2.API_KEY"
                            android:value="API-KEY"/>

                </application>
            </manifest>

回答by Jorge Cob

Try adding this in the build.gradle file:

尝试将其添加到 build.gradle 文件中:

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

回答by live-love

If you get the error: Cannot resolve symbol @integer ... you might need to define the values for the missing integers in your integers.xml file.

如果出现错误:无法解析符号 @integer ... 您可能需要在 integers.xml 文件中定义缺失整数的值。

If you don't have one already, you will need to create it at:

如果您还没有,则需要在以下位置创建它:

res/values/integers.xml

res/values/integers.xml

Example:

例子:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <integer name="my_int_val1">1000</integer>
    <integer name="my_int_val2">500</integer>
</resources>