android - 更新位置时 Android Studio 出错
问题描述
我不明白为什么我在尝试更新位置时收到此错误
mLocationrequest.setInterval(1000);
^
class file for com.google.android.gms.common.internal.safeparcel.zza not found
这些是依赖项
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-database:20.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation platform('com.google.firebase:firebase-bom:28.1.0')
implementation 'com.google.firebase:firebase-analytics'
compile 'com.google.android.gms:play-services-location:11.0.2'
}
这是代码
@Override
public void onConnected(@Nullable Bundle bundle) {
mLocationrequest = new LocationRequest();
mLocationrequest.setInterval(1000);
mLocationrequest.setFastestInterval(1000);
mLocationrequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED){return;
}
解决方案
推荐阅读
- java - 如何从数字数组列表中删除前导零?
- rest - Oracle Apex/ORDS REST 服务未使用 curl 正确发布数据 - 所有字段均为空
- php - oci_execute 不工作 (ERR_CONNECTION_TIMED_OUT)
- cocoa - NSOutlineView 的 NSTintConfiguration 简要呈现控件强调色,然后呈现单色
- mongodb - MongoDB 聚合查询(组)花费太多时间
- reactjs - Image fliker once 使用 setState() 更新图像列表
- jquery - 隐藏 WooCommerce 消息时试图理解 JS 错误
- python - 如何将 qgis 图保存到 shapefile 以在 networkx 中使用?
- unreal-engine4 - CreateExport:无法为资源加载 Outer
- html - 如何在 CSS 网站标题中添加字幕