使用Google Map与Flutter时出现错误

时间:2018-12-25 09:46:05

标签: dart flutter

在将google_maps_flutter: ^0.0.3+3插件与flutter一起使用时,我遇到了错误。

我完成了将google map与android manifest或ios runner一起使用的所有要求。

这是我的地图代码

GoogleMap(onMapCreated: (GoogleMapController controller) {},
            options: GoogleMapOptions(
              cameraPosition: CameraPosition(
                target: LatLng(36.382013, 43.143249),
              ),
              mapType: MapType.normal,
            ),
          ),

错误是这样的:

W/ResourcesManager( 9743): getTopLevelResources: /data/app/com.example.mis-2/base.apk / 1.0 running in com.example.mis rsrc of package null
I/zzbz    ( 9743): Making Creator dynamically
I/DynamiteModule( 9743): Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:221
I/DynamiteModule( 9743): Selected remote version of com.google.android.gms.maps_dynamite, version >= 221
W/ResourcesManager( 9743): getTopLevelResources: /data/app/com.google.android.gms-4/base.apk / 1.0 running in com.example.mis rsrc of package null
W/ResourcesManager( 9743): Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
W/ResourcesManager( 9743): Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
D/ApplicationPackageManager( 9743): getResourcesForApplication com.google.android.gms got new pi = android.app.LoadedApk@67b11be
W/ResourcesManager( 9743): getTopLevelResources: /data/data/com.google.android.gms/app_chimera/m/00000015/MapsDynamite.apk / 1.0 running in com.example.mis rsrc of package null
I/art     ( 9743): Background partial concurrent mark sweep GC freed 1553(129KB) AllocSpace objects, 0(0B) LOS objects, 24% free, 5MB/6MB, paused 9.674ms total 32.165ms
D/ApplicationPackageManager( 9743): getResourcesForApplication com.google.android.gms got new pi = android.app.LoadedApk@67b11be
W/ResourcesManager( 9743): getTopLevelResources: /data/data/com.google.android.gms/app_chimera/m/00000015/MapsDynamite.apk / 1.0 running in com.example.mis rsrc of package null
I/Google Maps Android API( 9743): Google Play services client version: 12451000
I/Google Maps Android API( 9743): Google Play services package version: 14799007
D/AbsListView( 9743): Get MotionRecognitionManager
E/MotionRecognitionManager( 9743): mSContextService = null
E/MotionRecognitionManager( 9743): motionService = com.samsung.android.motion.IMotionRecognitionService$Stub$Proxy@297b9bff
I/art     ( 9743): Background sticky concurrent mark sweep GC freed 12347(981KB) AllocSpace objects, 2(32KB) LOS objects, 14% free, 5MB/6MB, paused 5.401ms total 46.386ms
W/ContextImpl( 9743): Failed to ensure directory: /storage/extSdCard/Android/data/com.example.mis/cache
W/System.err( 9743): mkdir failed: EEXIST (File exists) : /storage/emulated/0/Android/data/com.example.mis/cache/debug
W/System.err( 9743): mkdir failed: EEXIST (File exists) : /storage/emulated/0/Android/data/com.example.mis/cache
I/System.out( 9743): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out( 9743): (HTTPLog)-Static: isShipBuild true
I/System.out( 9743): (HTTPLog)-Thread-1019-403128043: SmartBonding Enabling is false, SHIP_BUILD is true, log to file
is false, DBG is false
I/System.out( 9743): (HTTPLog)-Thread-1019-403128043: SMARTBONDING_FEATURE_ENABLED is false
I/System.out( 9743): (HTTPLog)-Static: isSBSettingEnabled false
I/art     ( 9743): Background partial concurrent mark sweep GC freed 1110(81KB) AllocSpace objects, 0(0B) LOS objects, 24% free, 6MB/8MB, paused 10.284ms total 41.198ms
I/System.out( 9743): KnoxVpnUidStorageknoxVpnSupported API value returned is false
D/PhoneWindow( 9743): *FMB* installDecor mIsFloating : false
D/PhoneWindow( 9743): *FMB* installDecor flags : -2139028216
E/GoogleMapController( 9743): Cannot enable MyLocation layer as location permissions are not granted
D/PhoneWindow( 9743): *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
D/PhoneWindow( 9743): *FMB* isFloatingMenuEnabled return false
I/System.out( 9743): KnoxVpnUidStorageknoxVpnSupported API value returned is false
I/System.out( 9743): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out( 9743): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out( 9743): KnoxVpnUidStorageknoxVpnSupported API value returned is false
I/System.out( 9743): KnoxVpnUidStorageknoxVpnSupported API value returned is false
W/DynamiteModule( 9743): Local module descriptor class for com.google.android.gms.googlecertificates not found.
I/DynamiteModule( 9743): Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:4
I/DynamiteModule( 9743): Selected remote version of com.google.android.gms.googlecertificates, version >= 4
D/ApplicationPackageManager( 9743): getResourcesForApplication com.google.android.gms got new pi = android.app.LoadedApk@67b11be
W/ResourcesManager( 9743): getTopLevelResources: /data/data/com.google.android.gms/app_chimera/m/00000014/GoogleCertificates.apk / 1.0 running in com.example.mis rsrc of package null
D/ApplicationPackageManager( 9743): getResourcesForApplication com.google.android.gms got new pi = android.app.LoadedApk@67b11be
W/ResourcesManager( 9743): getTopLevelResources: /data/data/com.google.android.gms/app_chimera/m/00000014/GoogleCertificates.apk / 1.0 running in com.example.mis rsrc of package null

2 个答案:

答案 0 :(得分:2)

我有同样的问题。对我有帮助的是:

  • Install and set up Google Play服务SDK。
  • 在应用程序部分AnroidManifest.xml下一行<uses-library android:name="org.apache.http.legacy" android:required="false"/>中添加

答案 1 :(得分:0)

就我而言,这是由于AndroidManifest.xml

中缺少权限

添加以下权限可以解决我的问题。

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

如果您正在使用模拟器,请确保您的模拟器具有Google Play服务。