Search code examples
firebaseandroid-studiofluttergoogle-mapsgeolocation

Error: "I/Process (26960): Sending signal. PID: 26960 SIG: 9 Lost connection to device." while using flutter on android studio


After I typed in this block of code, Every time I try to run the program, I get this
"I/Process (26960): Sending signal. PID: 26960 SIG: 9
Lost connection to device.

Below is the block of code.I had added all the permission and dependencies necessary to make this work but I'm still stuck on this error. Please assist me (I use 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();
          },
        ),
      ],
    );
  }
}


Solution

  • Okay, I'm leaving this here in case anyone else is facing the same problem. I added

    android.enableDexingArtifactTransform=false
    

    to gradle.properties and it worked.

    check out https://github.com/flutter/flutter/issues/72185 for more details