我正在尝试在我的应用中添加Google地图。我正在使用google_maps_flutter版本:0.5.21 + 7。我使用了来自Google Codelabs的以下代码。这是代码
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
GoogleMapController mapController;
final LatLng _center = const LatLng(45.521563, -122.677433);
void _onMapCreated(GoogleMapController controller) {
mapController = controller;
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Maps Sample App'),
backgroundColor: Colors.green[700],
),
body: GoogleMap(
onMapCreated: _onMapCreated,
initialCameraPosition: CameraPosition(
target: _center,
zoom: 11.0,
),
),
),
);
}
}
但是代码不起作用,地图未显示。这是我在android模拟器上运行时得到的错误报告,该应用在真实设备上崩溃。
/ (23740): HostConnection::get() New Host Connection established 0xcba7f740, tid 23754
I/zzbz (23740): Making Creator dynamically
W/mple.test_mapp(23740): Unsupported class loader
W/mple.test_mapp(23740): Skipping duplicate class check due to unsupported classloader
D/EGL_emulation(23740): eglMakeCurrent: 0xded8e8a0: ver 3 0 (tinfo 0xded203c0)
I/DynamiteModule(23740): Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:221
I/DynamiteModule(23740): Selected remote version of com.google.android.gms.maps_dynamite, version >= 221
V/DynamiteModule(23740): Dynamite loader version >= 2, using loadModule2NoCrashUtils
W/mple.test_mapp(23740): Unsupported class loader
W/mple.test_mapp(23740): Skipping duplicate class check due to unsupported classloader
I/Google Maps Android API(23740): Google Play services client version: 12451000
I/Google Maps Android API(23740): Google Play services package version: 19275040
W/mple.test_mapp(23740): Accessing hidden field Ljava/nio/Buffer;->address:J (light greylist, reflection)
E/GoogleMapController(23740): Cannot enable MyLocation layer as location permissions are not granted
I/mple.test_mapp(23740): Background concurrent copying GC freed 7812(1108KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 1783KB/3MB, paused 5.572ms total 32.898ms
D/ (23740): HostConnection::get() New Host Connection established 0xc05b5f40, tid 23799
D/EGL_emulation(23740): eglCreateContext: 0xbf4da240: maj 1 min 0 rcv 1
D/EGL_emulation(23740): eglMakeCurrent: 0xe0785600: ver 3 0 (tinfo 0xc807bd60)
D/EGL_emulation(23740): eglMakeCurrent: 0xbf4da240: ver 1 0 (tinfo 0xbf4c6160)
D/EGL_emulation(23740): eglMakeCurrent: 0xe0785600: ver 3 0 (tinfo 0xc807bd60)
D/ (23740): HostConnection::get() New Host Connection established 0xc05d0700, tid 23752
E/Google Maps Android API(23740): Authorization failure. Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
E/Google Maps Android API(23740): In the Google Developer Console (https://console.developers.google.com)
E/Google Maps Android API(23740): Ensure that the "Google Maps Android API v2" is enabled.
E/Google Maps Android API(23740): Ensure that the following Android Key exists:
E/Google Maps Android API(23740): Android Application (<cert_fingerprint>;<package_name>): 0E:5D:3B:4B:C1:50:A0:16:C4:FF:FB:C1:2B:C1:AC:D3:15:25:D3:F6;com.example.test_mapp2
D/EGL_emulation(23740): eglMakeCurrent: 0xe0785600: ver 3 0 (tinfo 0xc807bd60)
D/EGL_emulation(23740): eglMakeCurrent: 0xe0785600: ver 3 0 (tinfo 0xc807bd60)
W/DynamiteModule(23740): Local module descriptor class for com.google.android.gms.googlecertificates not found.
I/DynamiteModule(23740): Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:4
I/DynamiteModule(23740): Selected remote version of com.google.android.gms.googlecertificates, version >= 4
W/mple.test_mapp(23740): Unsupported class loader
W/mple.test_mapp(23740): Skipping duplicate class check due to unsupported classloader
答案 0 :(得分:1)
此错误日志In the Interface tab right click your UIFlow (For me it is called Common)
Add External Site
Rename External Site to "ExternalURL"
Right click ExternalURL
Add Input Parameter
Name the new Input "URL"
Set Is Manditory as Yes
Set Data Type as Text
On your link properties
Set Destination to UIFlowName\ExternalURL (For me it is called Common\ExternalURL)
Set URL to your desired address (example: "http://google.com")
Add an Extended Property called "formtarget"
Set its value to "_blank"
中的API授权失败。
我将在下面留下一些有关如何解决此问题的链接: Maps Android API: Authorization failure SO answer