gpt4 book ai didi

google-maps - Flutter- 询问 Nearbyplaces 时的获取和错误

转载 作者:行者123 更新时间:2023-12-04 08:53:41 29 4
gpt4 key购买 nike

嗨,我想在 Flutter 中实现 Google map 和附近的搜索,我几乎做到了,但我不明白在尝试获取我位置附近的地点时遇到的错误。
我在网上搜索,但我无法弄清楚,请谁能告诉我什么是错的。我花了将近 2 个小时在网上搜索修复程序,但一无所获。
这是代码:

import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_place/google_place.dart';

class MapScreen extends StatefulWidget {
@override
_MapScreenState createState() => _MapScreenState();
}

class _MapScreenState extends State<MapScreen> {
GoogleMapController mapController;
var googlePlace = GooglePlace("");
//this are the longitude and the latitude of the phone
double lng;
double lat;


void _onMapCreated(GoogleMapController controller) {
mapController = controller;
getPosition().then((value) => getLocationNearBy());
}

Future<Position> getPosition() async {
LocationPermission permission = await checkPermission();
LocationPermission permission2 = await requestPermission();
Position position =
await getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
lat = position.latitude;
lng = position.longitude;
print(position);
return position;
}

void getLocationNearBy() async {
var result = await googlePlace.search
.getNearBySearch(Location(lat: lat, lng: lng), 2000, type: "bars");
print(result);
}

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: GoogleMap(
myLocationEnabled: true,
myLocationButtonEnabled: true,
onMapCreated: _onMapCreated,
initialCameraPosition: CameraPosition(
target: _center,
zoom: 11.0,
),
),
),
);
}
}
这是错误:
 Considering local module com.google.android.gms.googlecertificates:0 and remote module 

com.google.android.gms.googlecertificates:6
I/DynamiteModule(18683): Selected remote version of com.google.android.gms.googlecertificates, version >= 6
I/DynamiteLoaderV2Impl(18683): [71] Googlecertificates
W/m.example.ipil(18683): ClassLoaderContext type mismatch. expected=PCL, found=DLC (PCL[] | DLC[];PCL[/data/app/com.example.ipill-sEbMOSkwYUXtrKfO0SfLPQ==/base.apk*4144957280:/data/app/com.example.ipill-sEbMOSkwYUXtrKfO0SfLPQ==/base.apk!classes2.dex*3286414090:/data/app/com.example.ipill-sEbMOSkwYUXtrKfO0SfLPQ==/base.apk!classes3.dex*660981783:/data/app/com.example.ipill-sEbMOSkwYUXtrKfO0SfLPQ==/base.apk!classes4.dex*371746816:/data/app/com.example.ipill-sEbMOSkwYUXtrKfO0SfLPQ==/base.apk!classes5.dex*1029310577:/data/app/com.example.ipill-sEbMOSkwYUXtrKfO0SfLPQ==/base.apk!classes6.dex*1730292004:/data/app/com.example.ipill-sEbMOSkwYUXtrKfO0SfLPQ==/base.apk!classes7.dex*2560797352:/data/app/com.example.ipill-sEbMOSkwYUXtrKfO0SfLPQ==/base.apk!classes8.dex*1790620740:/data/app/com.example.ipill-sEbMOSkwYUXtrKfO0SfLPQ==/base.apk!classes9.dex*2957673897:/data/app/com.example.ipill-sEbMOSkwYUXtrKfO0SfLPQ==/base.apk!classes10.dex*1136895787:/data/app/com.example.ipill-sEbMOSkwYUXtrKfO0SfLPQ==/base.apk!classes11.dex*1461101890:/data/app/com
W/m.example.ipil(18683): Found duplicate classes, falling back to extracting from APK : /data/user_de/0/com.google.android.gms/app_chimera/m/000000d4/GoogleCertificates.apk
W/m.example.ipil(18683): NOTE: This wastes RAM and hurts startup performance.
W/m.example.ipil(18683): Found duplicated class when checking oat files: 'Landroidx/annotation/Keep;' in /data/user_de/0/com.google.android.gms/app_chimera/m/000000d4/GoogleCertificates.apk and /data/app/com.example.ipill-sEbMOSkwYUXtrKfO0SfLPQ==/base.apk!classes13.dex
W/m.example.ipil(18683):
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
I/m.example.ipil(18683): NativeAlloc concurrent copying GC freed 83801(6328KB) AllocSpace objects, 143(8420KB) LOS objects, 49% free, 7253KB/14MB, paused 211us total 141.179ms
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
I/chatty (18683): uid=10378(com.example.ipill) GoogleApiHandle identical 3 lines
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
I/chatty (18683): uid=10378(com.example.ipill) GoogleApiHandle identical 2 lines
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
I/chatty (18683): uid=10378(com.example.ipill) GoogleApiHandle identical 1 line
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
I/chatty (18683): uid=10378(com.example.ipill) GoogleApiHandle identical 5 lines
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/m.example.ipil(18683): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
I/chatty (18683): uid=10378(com.example.ipill) GoogleApiHandle identical 4 lines

最佳答案

要解决此问题,请确保您的 pubspec.yaml 和 google.services.gms 中没有包位置。

关于google-maps - Flutter- 询问 Nearbyplaces 时的获取和错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63961843/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com