2017-10-11 57 views
2

我试图使用街景视图API实现自动完成地点搜索。 我下面是我的依赖关系:Android studio无法解析导入com.google.android.gms.location.places.Place;

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:25.3.1' 
    compile 'com.google.android.gms:play-services-maps:11.0.4' 
    testCompile 'junit:junit:4.12' 
} 

的元数据如下:

<meta-data 
     android:name="com.google.android.geo.API_KEY" 
     android:value="@string/google_maps_key" /> 

我已经安装了所有需要的SDK,但我的机器人工作室无法解决的地方在下面的部分进口:

import com.google.android.gms.location.places.Place; 
import com.google.android.gms.location.places.ui.PlaceAutocomplete; 

这是它的样子: Error

回答

0

添加这种依赖性的gradle中文件

compile 'com.google.android.gms:play-services-places:9.2.0' 
0

在的build.gradle在底部添加此(模块应用程序)。

应用插件: 'com.google.gms.google服务'

+0

它是添加母库的好方法? – Amy

相关问题