所有者错误。也许是后期断开

时间:2018-09-25 10:21:01

标签: android google-maps

我试图在我的Android应用程序中包含地图,但出现此错误“所有者错误。可能是断开连接晚了”,并且断开连接。 logcat。我真的不知道该怎么做。我已经创建了api密钥并将其添加到应用程序中。有人应该帮助我解决这个问题。

Logcat

handshakeCompleted
09-25 11:58:25.793 32643-393/com.digitalcore.primixidriverapp W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found.
09-25 11:58:25.813 32643-393/com.digitalcore.primixidriverapp I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:4
09-25 11:58:25.814 32643-393/com.digitalcore.primixidriverapp I/DynamiteModule: Selected remote version of com.google.android.gms.googlecertificates, version >= 4
09-25 11:58:25.820 32643-393/com.digitalcore.primixidriverapp W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/0000003b/n/armeabi-v7a
    ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/0000003b/n/armeabi
09-25 11:58:26.614 32643-32747/com.digitalcore.primixidriverapp D/NativeCrypto: ssl=0x93927680 cert_verify_callback => 1
09-25 11:58:26.633 32643-32747/com.digitalcore.primixidriverapp D/NativeCrypto: ssl=0x93927680 NativeCrypto_SSL_get_certificate => NULL
09-25 11:58:26.637 32643-32747/com.digitalcore.primixidriverapp I/System.out: [OkHttp] sendRequest>>
09-25 11:58:26.638 32643-32747/com.digitalcore.primixidriverapp I/System.out: [OkHttp] sendRequest<<
09-25 11:58:26.900 32643-32747/com.digitalcore.primixidriverapp D/NativeCrypto: ssl=0x93927680 info_callback calling handshakeCompleted
09-25 11:58:26.996 32643-32747/com.digitalcore.primixidriverapp I/System.out: Wrong owner. Perhaps a late disconnect
09-25 11:58:29.014 32643-32662/com.digitalcore.primixidriverapp V/FA: Inactivity, disconnecting from the service
09-25 11:59:23.480 32643-32727/com.digitalcore.primixidriverapp D/NativeCrypto: ssl=0xa3ac0640 NativeCrypto_SSL_interrupt
09-25 11:59:23.481 32643-32727/com.digitalcore.primixidriverapp I/System.out: close [socket][/10.170.69.215:45150]

这是在手机上加载地图时使用的地图片段的my代码。 MapFragment

public class DriverMapActivity extends FragmentActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, com.google.android.gms.location.LocationListener {

private GoogleMap mMap;
GoogleApiClient mGoogleApiClient;
Location mLastLocation;
LocationRequest mLocationRequest;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_driver_map);
    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
}




/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move the camera. In this case,
 * we just add a marker near Sydney, Australia.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        return;
    }
    buildGoogleApiClient();
    mMap.setMyLocationEnabled(true);
}

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

@Override
public void onLocationChanged(Location location) {
    mLastLocation = location;
    Toast.makeText(DriverMapActivity.this, String.valueOf(location.getLatitude()), Toast.LENGTH_SHORT).show();
    LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
    mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
    mMap.animateCamera(CameraUpdateFactory.zoomTo(11));
}

@Override
public void onConnected(@Nullable Bundle bundle) {
    mLocationRequest = new LocationRequest();
    mLocationRequest.setInterval(1000);
    mLocationRequest.setFastestInterval(1000);
    mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
    if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        return;
    }
    LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
}

@Override
public void onConnectionSuspended(int i) {

}

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

}

0 个答案:

没有答案