Android class 'GeofencingClient' 不存在?
Android class 'GeofencingClient' doesn't exist?
我正在尝试遵循 Android geofencing guide,但当我尝试声明 GeofencingClient
变量时立即卡住了:
通常我只需按 Alt+Enter 和 select "Import class",但此选项在这里不可用:
GeofencingClient
class 还存在吗?我需要安装一些第三方库吗?
添加import com.google.android.gms.location.GeofencingClient
...
这取决于Google Play Services:
dependencies {
implementation "com.google.android.gms:play-services-base:17.1.0"
implementation "com.google.android.gms:play-services-location:17.0.0"
}
GeofencingClient 是 Google Play 服务的一部分。您需要将以下依赖添加到模块的 build.gradle 文件中,然后您就可以在代码中导入 class:
dependencies {
// ...
implementation 'com.google.android.gms:play-services-location:17.0.0'
//...
}
我正在尝试遵循 Android geofencing guide,但当我尝试声明 GeofencingClient
变量时立即卡住了:
通常我只需按 Alt+Enter 和 select "Import class",但此选项在这里不可用:
GeofencingClient
class 还存在吗?我需要安装一些第三方库吗?
添加import com.google.android.gms.location.GeofencingClient
...
这取决于Google Play Services:
dependencies {
implementation "com.google.android.gms:play-services-base:17.1.0"
implementation "com.google.android.gms:play-services-location:17.0.0"
}
GeofencingClient 是 Google Play 服务的一部分。您需要将以下依赖添加到模块的 build.gradle 文件中,然后您就可以在代码中导入 class:
dependencies {
// ...
implementation 'com.google.android.gms:play-services-location:17.0.0'
//...
}