猿问

无法投射到 com.google.android.gms.location

当我尝试运行我的应用程序时,应用程序崩溃了,并且在日志 cat 中我看到了这个错误。


--------- beginning of crash

09-07 22:46:49.571 3479-3479/com.example.www.mytaxiapp E/AndroidRuntime: FATAL EXCEPTION: main

Process: com.example.www.mytaxiapp, PID: 3479

java.lang.ClassCastException: com.example.www.mytaxiapp.Welcome cannot be cast to com.google.android.gms.location.LocationListener

    at com.example.www.mytaxiapp.Welcome.startLocationUpdates(Welcome.java:272)

    at com.example.www.mytaxiapp.Welcome.onConnected(Welcome.java:308)

这是我的进口


import android.Manifest;

import android.content.pm.PackageManager;

import android.location.Location;

import android.location.LocationListener;

import android.os.Handler;

import android.os.SystemClock;

import android.support.annotation.NonNull;

import android.support.annotation.Nullable;

import android.support.design.widget.Snackbar;

import android.support.v4.app.ActivityCompat;

import android.support.v4.app.FragmentActivity;

import android.os.Bundle;

import android.util.Log;

import android.view.animation.Interpolator;

import android.view.animation.LinearInterpolator;

import android.widget.Toast;


import com.firebase.geofire.GeoFire;

import com.firebase.geofire.GeoLocation;

import com.github.glomadrian.materialanimatedswitch.MaterialAnimatedSwitch;

import com.google.android.gms.common.ConnectionResult;

import com.google.android.gms.common.GooglePlayServicesUtil;

import com.google.android.gms.common.api.GoogleApiClient;

import com.google.android.gms.location.LocationRequest;

import com.google.android.gms.location.zzal;

import com.google.android.gms.location.LocationServices;

import com.google.android.gms.maps.CameraUpdateFactory;

import com.google.android.gms.maps.GoogleMap;

import com.google.android.gms.maps.OnMapReadyCallback;

import com.google.android.gms.maps.SupportMapFragment;


MMTTMM
浏览 224回答 1
1回答
随时随地看视频慕课网APP

相关分类

Java
我要回答