Error: "I/Process (26960): Sending signal. PID: 26960 SIG: 9 Lost connection to device." while using flutter on android studio
Error: "I/Process (26960): Sending signal. PID: 26960 SIG: 9 Lost connection to device." while using flutter on android studio
在我输入这段代码后,每次我尝试 运行 这个程序时,我都会得到这个
"I/Process (26960): 发送信号。PID: 26960 SIG: 9
与设备失去连接。
下面是 code.I 的代码块,它添加了所有必要的权限和依赖项来完成这项工作,但我仍然卡在这个错误上。请帮助我(我使用windows)。
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
class HomeTabPage extends StatelessWidget
{
Completer<GoogleMapController> _controllerGoogleMap = Completer();
GoogleMapController newGoogleMapController;
static final CameraPosition _kGooglePlex = CameraPosition(
target: LatLng(37.42796133580664, -122.085749655962),
zoom: 14.4746,
);
Position currentPosition;
var geolocator = Geolocator();
void locatePosition() async
{
Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
currentPosition = position;
LatLng intLatPosition = LatLng(position.latitude, position.longitude);
CameraPosition cameraPosition = new CameraPosition(target: intLatPosition, zoom: 14);
newGoogleMapController.animateCamera(CameraUpdate.newCameraPosition(cameraPosition));
//String address = await AssistantMethods.searchCoordinateAddress(position, context);
//print("This is your Address :: " + address);
}
@override
Widget build(BuildContext context)
{
return Stack(
children: [
GoogleMap(
mapType: MapType.normal,
myLocationButtonEnabled: true,
initialCameraPosition: _kGooglePlex,
myLocationEnabled: true,
onMapCreated: (GoogleMapController controller)
{
_controllerGoogleMap.complete(controller);
newGoogleMapController = controller;
locatePosition();
},
),
],
);
}
}
您好,可能是权限问题,请将这行代码添加到您的/android/app/src/main/AndroidManifest.xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
好的,我把它留在这里以防其他人遇到同样的问题。我加了
android.enableDexingArtifactTransform=false
到 gradle.properties 并且有效。
在我输入这段代码后,每次我尝试 运行 这个程序时,我都会得到这个
"I/Process (26960): 发送信号。PID: 26960 SIG: 9
与设备失去连接。
下面是 code.I 的代码块,它添加了所有必要的权限和依赖项来完成这项工作,但我仍然卡在这个错误上。请帮助我(我使用windows)。
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
class HomeTabPage extends StatelessWidget
{
Completer<GoogleMapController> _controllerGoogleMap = Completer();
GoogleMapController newGoogleMapController;
static final CameraPosition _kGooglePlex = CameraPosition(
target: LatLng(37.42796133580664, -122.085749655962),
zoom: 14.4746,
);
Position currentPosition;
var geolocator = Geolocator();
void locatePosition() async
{
Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
currentPosition = position;
LatLng intLatPosition = LatLng(position.latitude, position.longitude);
CameraPosition cameraPosition = new CameraPosition(target: intLatPosition, zoom: 14);
newGoogleMapController.animateCamera(CameraUpdate.newCameraPosition(cameraPosition));
//String address = await AssistantMethods.searchCoordinateAddress(position, context);
//print("This is your Address :: " + address);
}
@override
Widget build(BuildContext context)
{
return Stack(
children: [
GoogleMap(
mapType: MapType.normal,
myLocationButtonEnabled: true,
initialCameraPosition: _kGooglePlex,
myLocationEnabled: true,
onMapCreated: (GoogleMapController controller)
{
_controllerGoogleMap.complete(controller);
newGoogleMapController = controller;
locatePosition();
},
),
],
);
}
}
您好,可能是权限问题,请将这行代码添加到您的/android/app/src/main/AndroidManifest.xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
好的,我把它留在这里以防其他人遇到同样的问题。我加了
android.enableDexingArtifactTransform=false
到 gradle.properties 并且有效。