Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/389.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java API级别26未识别com.google.android.geo.API_密钥_Java_Android_Android Studio - Fatal编程技术网

Java API级别26未识别com.google.android.geo.API_密钥

Java API级别26未识别com.google.android.geo.API_密钥,java,android,android-studio,Java,Android,Android Studio,我正在使用PlaceAutoComplete开发一个带有API26(Android 8.0)的应用程序,要使用它,我需要添加一个谷歌地图API。我遵循了本指南的步骤,当我尝试在代码上使用API时,它不会识别geo。上面说: error: cannot find symbol Places.initialize(getApplicationContext(), com.google.android.geo.API_KEY); 我能做什么?非常感谢 AndroidManifest.

我正在使用PlaceAutoComplete开发一个带有API26(Android 8.0)的应用程序,要使用它,我需要添加一个谷歌地图API。我遵循了本指南的步骤,当我尝试在代码上使用API时,它不会识别geo。上面说:

error: cannot find symbol
        Places.initialize(getApplicationContext(), com.google.android.geo.API_KEY);
我能做什么?非常感谢

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
给出MainActivity.java中问题的代码行

Places.initialize(getApplicationContext(), com.google.android.geo.API_KEY);

XML代码?你在哪里调用API?在MainActivity.java中,等一下,我会编辑代码。你可能需要用你自己的API密钥替换“com.google.android.geo.API_KEY”?不,因为如果你按照我在文章中的指南,它说将其存储在local.properties中更安全
    ## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/home/myuser/Android/Sdk
API_KEY=my-api-key
Places.initialize(getApplicationContext(), com.google.android.geo.API_KEY);