Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/191.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 我正在创建一个像Uber这样的应用程序,但它突然崩溃,出现了预期的BEGIN_数组错误,但在第1行第1列路径处出现了字符串$_Android_Arrays_List_Compiler Errors_Runtime Error - Fatal编程技术网

Android 我正在创建一个像Uber这样的应用程序,但它突然崩溃,出现了预期的BEGIN_数组错误,但在第1行第1列路径处出现了字符串$

Android 我正在创建一个像Uber这样的应用程序,但它突然崩溃,出现了预期的BEGIN_数组错误,但在第1行第1列路径处出现了字符串$,android,arrays,list,compiler-errors,runtime-error,Android,Arrays,List,Compiler Errors,Runtime Error,我正在尝试创建一个像Uber这样的应用程序,我正在为驱动程序解析客户的地理位置和UID。我使用Map数组获取customerUID,使用List数组分别获取纬度和经度。但当我试图编译和运行时,它显示了一个错误: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $. 以前它工作得很好,但现在我甚至无法撤消我所做的更改,因为我关闭了项目并重新启动它,认为它可能会解决问题,但这导致我无法撤消任何步骤 下面是我的项目代码,它可能

我正在尝试创建一个像Uber这样的应用程序,我正在为驱动程序解析客户的地理位置和UID。我使用Map数组获取customerUID,使用List数组分别获取纬度和经度。但当我试图编译和运行时,它显示了一个错误:

 Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $.
以前它工作得很好,但现在我甚至无法撤消我所做的更改,因为我关闭了项目并重新启动它,认为它可能会解决问题,但这导致我无法撤消任何步骤

下面是我的项目代码,它可能会帮助您帮助我解决错误

package com.matt.dumate;

import com.directions.route.AbstractRouting;
import com.directions.route.Route;
import com.directions.route.RouteException;
import com.directions.route.Routing;
import com.directions.route.RoutingListener;
import com.firebase.geofire.GeoFire;
import com.firebase.geofire.GeoLocation;
import com.firebase.geofire.GeoQuery;
import com.firebase.geofire.GeoQueryEventListener;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;

import android.Manifest;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class Welcome extends FragmentActivity implements OnMapReadyCallback,
        GoogleApiClient.ConnectionCallbacks,
        GoogleApiClient.OnConnectionFailedListener,
        LocationListener, RoutingListener{

SupportMapFragment mapFragment;

private Button btnBooking;
private Location lastLocation;
private GoogleApiClient.OnConnectionFailedListener onConnectionFailedListener;
private LocationRequest locationRequest;
private LocationListener locationListener;
private LocationManager locationManager;
private Marker marker, driverMarker;
private GoogleMap mMap;
private GoogleApiClient googleApiClient;
private final int RequestCode = 10;
private final int ResourceCode = 11;
private DatabaseReference userLastLocation, customersUnderServiceRef, userRequest, driversOnDuty,workingDrivers, driverRef1, driverWorkingRef ;
GeoFire location, request, onDuty, customersUnderService;
private Boolean clicked = false;
private String driverID = "";
private ValueEventListener driverListener;
private GeoQuery geoQuery;
private String myId = "";
private Double driverLat, driverLng;


@Override
protected void onCreate(Bundle savedInstanceState)
{

    checkLocationPermission();
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_welcome);
    mapFragment = (SupportMapFragment)
            getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
    locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);

    userLastLocation = FirebaseDatabase.getInstance().getReference("User LastLocation");
    location = new GeoFire(userLastLocation);
    setupLocation();

    userRequest = FirebaseDatabase.getInstance().getReference("User Request");
    request = new GeoFire(userRequest);

    driversOnDuty = FirebaseDatabase.getInstance().getReference("DriversOnDuty");
    onDuty = new GeoFire(driversOnDuty);



    driverRef1 = FirebaseDatabase.getInstance().getReference().child("Driver").child(driverID);

    driverWorkingRef = FirebaseDatabase.getInstance().getReference().child("DriversWorking");

    customersUnderServiceRef = FirebaseDatabase.getInstance().getReference().child("CustomersUnderService");
    customersUnderService = new GeoFire(customersUnderServiceRef);
    workingDrivers = FirebaseDatabase.getInstance().getReference().child("DriversWorking").child(driverID);
}

@Override
public void onMapReady(GoogleMap googleMap)
{
    myId = FirebaseAuth.getInstance().getCurrentUser().getUid();
    setupUiViews();
    mMap = googleMap;
    displayLocation();
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
{
    switch (requestCode) {
        case RequestCode:
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                if (checkPlayServices()){
                    buildGoogleApiClient();
                    createLocationRequest();
                        displayLocation();
                }
            }
            break;
    }
}

@Override
public void onConnected(@Nullable Bundle bundle)
{
    if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)
    {
        locationRequest = LocationRequest
                .create()
                .setInterval(1000)
                .setFastestInterval(500)
                .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

        startLocationUpdates();
        displayLocation();

    }else {
        checkLocationPermission();
    }

}

@Override
public void onConnectionSuspended(int i)

{
    googleApiClient.connect();
}

@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult)
{
}

@Override
public void onLocationChanged(Location location)
{
    lastLocation = location;
    displayLocation2();

}

public void checkLocationPermission()
{
    if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)
    {
        if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION))
        {
            ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, RequestCode);
        } else {
            ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, RequestCode);
        }
    } else {
        Toast.makeText(this, "Location Permissions Granted", Toast.LENGTH_SHORT).show();
    }
}

protected synchronized void buildGoogleApiClient()
{
    googleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(LocationServices.API)
            .build();
    googleApiClient.connect();
}

private void setupUiViews()

{
    btnBooking = findViewById(R.id.bookingButton);
    btnBooking.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
                if (clicked == false) {
                    startLocationUpdates();
                    displayLocation2();
                    getNearestDriver();
                    Toast.makeText(Welcome.this, "Getting Cab", Toast.LENGTH_SHORT).show();
                    btnBooking.setText("Getting Your Cab..");
                    clicked = true;

                } else
                    {
                        disconnection();


                        try{
                            driverRef1.child("customerRideId").removeValue();
                        }catch (Exception a){
                            return;
                        }
                        stopLocationUpdates();
                        String userId = FirebaseAuth.getInstance().getCurrentUser().getUid();
                        DatabaseReference databaseReference1 = FirebaseDatabase.getInstance().getReference("Customer Request");
                        GeoFire geoFire1 = new GeoFire(databaseReference1);
                        geoFire1.removeLocation(userId);
                        Toast.makeText(Welcome.this, "Canceling Cab", Toast.LENGTH_SHORT).show();
                        btnBooking.setText("Get Cab");
                        if(driverMarker!=null){
                            driverMarker.remove();
                        }
                        clicked = false;
                }
        }
    });
}

private void displayLocation()

{
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
            ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
    {
        return;
    }
    lastLocation = LocationServices.FusedLocationApi.getLastLocation(googleApiClient);
    if (lastLocation != null ){
            final Double lat = lastLocation.getLatitude();
            final Double lng = lastLocation.getLongitude();

            location.setLocation(FirebaseAuth.getInstance().getCurrentUser().getUid(), new GeoLocation(lat, lng), new GeoFire.CompletionListener()
            {
                @Override
                public void onComplete(String key, DatabaseError error) {
                    if (marker != null) {
                        marker.remove();
                        marker = mMap.addMarker(new MarkerOptions().position(new LatLng(lat, lng)).icon(BitmapDescriptorFactory.fromResource(R.drawable.locationmarker)).title("You"));

                        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 15.0f));
                    }else{
                        marker = mMap.addMarker(new MarkerOptions().position(new LatLng(lat, lng)).icon(BitmapDescriptorFactory.fromResource(R.drawable.locationmarker)).title("You"));

                        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 15.0f));
                    }
                }
            });

    }else{
        Log.d("Error", "Cannot Get Your Location");
    }
}

private void displayLocation2()
{
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
            ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
    {
        return;
    }
    lastLocation = LocationServices.FusedLocationApi.getLastLocation(googleApiClient);
    if (lastLocation != null ){
        if(clicked == true){
            final Double lat = lastLocation.getLatitude();
            final Double lng = lastLocation.getLongitude();


            request.setLocation(FirebaseAuth.getInstance().getCurrentUser().getUid(), new GeoLocation(lat, lng), new GeoFire.CompletionListener()
            {
                @Override
                public void onComplete(String key, DatabaseError error) {
                    if (marker != null) {
                        marker.remove();
                        marker = mMap.addMarker(new MarkerOptions().position(new LatLng(lat, lng)).icon(BitmapDescriptorFactory.fromResource(R.drawable.locationmarker)).title("You"));

                    }else{
                        marker = mMap.addMarker(new MarkerOptions().position(new LatLng(lat, lng)).icon(BitmapDescriptorFactory.fromResource(R.drawable.locationmarker)).title("You"));
                        }
                }
            });
        }
    }else{
        Log.d("Error", "Cannot Get Your Location");
    }
}

private void setupLocation()
{
    if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)
    {
        if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION))
        {
            ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, RequestCode);
        } else {
            ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, RequestCode);
        }
    }else{
        if (checkPlayServices())
        {
            buildGoogleApiClient();
            createLocationRequest();

        }
    }
}

private void createLocationRequest()
{
    locationRequest = LocationRequest.create()
            .setInterval(1500)
            .setFastestInterval(500)
            .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
            .setSmallestDisplacement(0);
}

private boolean checkPlayServices()
{
    int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    if (resultCode != ConnectionResult.SUCCESS)
    {
        if (GooglePlayServicesUtil.isUserRecoverableError(resultCode))
            GooglePlayServicesUtil.getErrorDialog(resultCode, this, ResourceCode).show();
        else {
            Toast.makeText(this, "This Device Is Not Supported", Toast.LENGTH_SHORT).show();
            finish();
        }return false;
    }
    return true;
}

private void stopLocationUpdates()
{
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
    {
        return;
    }
    LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, this);
}

private void startLocationUpdates()
{
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
    {
        return;
    }
    LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, locationRequest, this);
}

private int radius = 1;
private Boolean driverFound = false;

private void getNearestDriver()
{

    geoQuery = location.queryAtLocation(new GeoLocation(lastLocation.getLatitude(), lastLocation.getLongitude()), radius);
    geoQuery.removeAllListeners();

    geoQuery.addGeoQueryEventListener(new GeoQueryEventListener() {
        @Override
        public void onKeyEntered(String key, GeoLocation location) {

             String driverId = key;
            if(!driverFound){
                driverFound = true;
                driverID = key;
                DatabaseReference driverRef = FirebaseDatabase.getInstance().getReference().child("Driver").child(driverId);

                String customerId = FirebaseAuth.getInstance().getCurrentUser().getUid();

                HashMap map = new HashMap();
                map.put("customerRideId", customerId);
                driverRef.updateChildren(map);

                driverID = key;
                btnBooking.setText("Getting Driver Location");

                customersUnderService.setLocation(FirebaseAuth.getInstance().getCurrentUser().getUid(), new GeoLocation(lastLocation.getLatitude(), lastLocation.getLongitude()));

                getDriverLocation();


            }

        }

        @Override
        public void onKeyExited(String key) {
            disconnection();

        }

        @Override
        public void onKeyMoved(String key, GeoLocation location) { }

        @Override
        public void onGeoQueryReady() {
            if(!driverFound){
                radius++;
                getNearestDriver();
            }
        }

        @Override
        public void onGeoQueryError(DatabaseError error) {
            disconnection();
            Toast.makeText(Welcome.this, "GeoQuery Error", Toast.LENGTH_SHORT);
        }
    });
}

private void getDriverLocation()
{
    driverWorkingRef = driverWorkingRef.child(driverID).child("l");
    driverListener = driverWorkingRef.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            if (dataSnapshot.exists()){
                List<Object> map = (List<Object>) dataSnapshot.getValue();
                double locationLat = 0;
                double locationLng = 0;

                btnBooking.setText("Driver Found");

                if (map.get(0) != null)
                {
                    locationLat = Double.parseDouble(map.get(0).toString());
                    driverLat = locationLat;
                }

                if (map.get(1) != null)
                {
                    locationLng = Double.parseDouble(map.get(1).toString());
                    driverLng = locationLng;
                }

                LatLng driverLatLng = new LatLng(locationLat, locationLng);

                if (driverMarker != null) {
                    driverMarker.remove();
                }
                    driverMarker = mMap.addMarker(new MarkerOptions().position(driverLatLng).icon(BitmapDescriptorFactory.fromResource(R.drawable.carmarker)).title("You"));
                    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(driverLatLng, 15.0f));

                    Location myLoc = new Location("");
                    Location driverLoc = new Location("");

                    myLoc.setLatitude(lastLocation.getLatitude());
                    myLoc.setLongitude(lastLocation.getLongitude());

                    driverLoc.setLatitude(locationLat);
                    driverLoc.setLongitude(locationLng);

                    float distance = myLoc.distanceTo(driverLoc);
                    ;
                    if (distance<100){
                        btnBooking.setText("Driver Reached");

                    }else{
                        btnBooking.setText("Driver at " + distance);

                    }
            }getDriverLocation();

        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
            disconnection();
        }
    });
}

@Override
public void onRoutingFailure(RouteException e)
{}
@Override
public void onRoutingStart()
{}
@Override
public void onRoutingSuccess(ArrayList<Route> arrayList, int i)
{}

@Override
public void onRoutingCancelled()
{}
private void disconnection(){

    try {
        customersUnderService.removeLocation(myId);
    }catch(Exception b){ }

    try {
        driverWorkingRef.removeEventListener(driverListener);
    }catch(Exception c){

    }
    try {
        onDuty.setLocation(driverID,new GeoLocation(driverLat, driverLng));
    }catch(Exception d){ }

    try {
        geoQuery.removeAllListeners();
    }catch(Exception f){ }

    try {
        request.removeLocation(myId);
    }catch(Exception g){ }

    try
    {
    driverRef1.child("customerRideId").removeValue();

    } catch(Exception h) { }


    try
    {
        onDuty.setLocation(driverID,new GeoLocation(driverLat, driverLng));
    } catch(Exception h) { }

    driverFound = false;
    if (driverMarker != null){
        driverMarker.remove();
    }
    btnBooking.setText("Get Cab");
    clicked = false;

}
@Override
protected void onStop()
{
    super.onStop();
    //disconnection();
}
private void getDirection(LatLng latLng)
{

    Routing routing = new Routing.Builder()
            .travelMode(AbstractRouting.TravelMode.DRIVING)
            .withListener(this)
            .alternativeRoutes(true)
            .waypoints(new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude()), latLng)
            .build();
    routing.execute();

}

@Override
protected void onPause() {
    super.onPause();
}
}
package com.matt.dumate;
导入com.directions.route.AbstractRouting;
导入com.directions.route.route;
导入com.directions.route.RouteException;
导入com.directions.route.Routing;
导入com.directions.route.RoutingListener;
导入com.firebase.geofire.geofire;
导入com.firebase.geofire.GeoLocation;
导入com.firebase.geofire.GeoQuery;
导入com.firebase.geofire.GeoQueryEventListener;
导入com.google.android.gms.common.GooglePlayServicesUtil;
导入com.google.android.gms.location.LocationListener;
导入com.google.android.gms.location.LocationServices;
导入com.google.android.gms.maps.CameraUpdateFactory;
导入com.google.android.gms.maps.model.BitmapDescriptorFactory;
导入com.google.android.gms.maps.model.LatLng;
导入android.Manifest;
导入android.content.pm.PackageManager;
导入android.location.location;
导入android.location.LocationManager;
导入android.support.annotation.NonNull;
导入android.support.annotation.Nullable;
导入android.support.v4.app.ActivityCompat;
导入android.support.v4.app.FragmentActivity;
导入android.os.Bundle;
导入android.support.v4.content.ContextCompat;
导入android.util.Log;
导入android.view.view;
导入android.widget.Button;
导入android.widget.Toast;
导入com.google.android.gms.common.ConnectionResult;
导入com.google.android.gms.common.api.GoogleAppClient;
导入com.google.android.gms.location.LocationRequest;
导入com.google.android.gms.maps.GoogleMap;
导入com.google.android.gms.maps.OnMapReadyCallback;
导入com.google.android.gms.maps.SupportMapFragment;
导入com.google.android.gms.maps.model.Marker;
导入com.google.android.gms.maps.model.MarkerOptions;
导入com.google.android.gms.tasks.OnSuccessListener;
导入com.google.firebase.auth.FirebaseAuth;
导入com.google.firebase.database.DataSnapshot;
导入com.google.firebase.database.DatabaseError;
导入com.google.firebase.database.DatabaseReference;
导入com.google.firebase.database.FirebaseDatabase;
导入com.google.firebase.database.ValueEventListener;
导入java.util.ArrayList;
导入java.util.HashMap;
导入java.util.List;
公共类Welcome扩展了FragmentActivity在MapreadyCallback上的实现,
GoogleAppClient.ConnectionCallbacks,
GoogleAppClient.OnConnectionFailedListener,
LocationListener,RoutingListener{
SupportMapFragment-mapFragment;
私人按钮btnBooking;
私人场所;
private GoogleAppClient.OnConnectionFailedListener OnConnectionFailedListener;
私人位置请求位置请求;
私有位置侦听器位置侦听器;
私人场所经理场所经理;
专用标记器;
私有谷歌地图;
私人GoogleapClient GoogleapClient;
私人最终int请求代码=10;
私有最终int ResourceCode=11;
私有数据库参考userLastLocation、CustomerUnderServiceRef、userRequest、driversOnDuty、workingDrivers、driverRef1、driverWorkingRef;
GeoFire位置、请求、onDuty、客户服务;
private=false;
私有字符串driverID=“”;
私人价值观;
专用地理查询;
私有字符串myId=“”;
专用双驱动器AT、驱动器NG;
@凌驾
创建时受保护的void(Bundle savedInstanceState)
{
checkLocationPermission();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
mapFragment=(SupportMapFragment)
getSupportFragmentManager()
.findFragmentById(R.id.map);
getMapAsync(这个);
locationManager=(locationManager)getSystemService(位置服务);
userLastLocation=FirebaseDatabase.getInstance().getReference(“用户LastLocation”);
位置=新的GeoFire(userLastLocation);
setupLocation();
userRequest=FirebaseDatabase.getInstance().getReference(“用户请求”);
请求=新的GeoFire(userRequest);
driversOnDuty=FirebaseDatabase.getInstance().getReference(“driversOnDuty”);
onDuty=新的GeoFire(driversOnDuty);
driverRef1=FirebaseDatabase.getInstance().getReference().child(“驱动程序”).child(driverID);
driverWorkingRef=FirebaseDatabase.getInstance().getReference().child(“DriverWorking”);
CustomerUnderServiceRef=FirebaseDatabase.getInstance().getReference().child(“CustomerUnderService”);
CustomerUnderService=新GeoFire(CustomerUnderServiceRef);
workingDrivers=FirebaseDatabase.getInstance().getReference().child(“DriversWorking”).child(driverID);
}
@凌驾
4月1日公开作废(谷歌地图谷歌地图)
{
myId=FirebaseAuth.getInstance().getCurrentUser().getUid();
setupUiViews();
mMap=谷歌地图;
显示位置();
}
@凌驾
public void onRequestPermissionsResult(int-requestCode,@NonNull-String[]permissions,@NonNull-int[]grantResults)
{
开关(请求代码){
案例请求代码:
if(grantResults.length>0&&grantResults[0]==PackageManager.PERMISSION\u已授予){
如果(checkPlayServices()){
buildGoogleAppClient();
createLocationRequest();
显示位置();
}
}
打破
}
}
@凌驾
未连接的公共无效(@Nullable Bundle)
{
如果(上下文)
Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $
at com.google.gson.Gson.fromJson(Gson.java:899)
at com.google.gson.Gson.fromJson(Gson.java:852)
at com.android.build.gradle.internal.pipeline.SubStream.loadSubStreams(SubStream.java:129)
at com.android.build.gradle.internal.pipeline.IntermediateFolderUtils.<init>(IntermediateFolderUtils.java:66)
at com.android.build.gradle.internal.pipeline.IntermediateStream.init(IntermediateStream.java:191)
at com.android.build.gradle.internal.pipeline.IntermediateStream.asOutput(IntermediateStream.java:135)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:228)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:217)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:212)
at sun.reflect.GeneratedMethodAccessor568.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
... 107 more
Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $
at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:350)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:80)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
at com.google.gson.Gson.fromJson(Gson.java:887)
... 130 more