Performance 在android 1.3.2中显示google地图时出错

Performance 在android 1.3.2中显示google地图时出错,performance,android-activity,Performance,Android Activity,在地图视图中,我在程序中添加的放大和缩小位置指针可见,但地图不可见 请帮我找出错误所在 这是我的主要活动文件: package com.example.lenovo.googlemaps; import android.location.Address; import android.location.Geocoder; import android.location.Location; import android.os.Bundle; import android.support.v7.

在地图视图中,我在程序中添加的放大和缩小位置指针可见,但地图不可见

请帮我找出错误所在

这是我的主要活动文件:

package com.example.lenovo.googlemaps;

import android.location.Address;
import android.location.Geocoder;
import android.location.Location; 
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

import com.google.android.gms.common.api.GoogleApiClient;
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.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

import java.io.IOException;
import java.util.List;
import java.util.Locale;

public class MapsActivity extends AppCompatActivity implements OnMapReadyCallback,
        GoogleMap.OnMyLocationChangeListener,
        android.location.LocationListener {

    private GoogleMap mGoogleMap;
    private Geocoder mGeocoder;

    private GoogleApiClient mGoogleApiClient = null;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_maps);

        SupportMapFragment mSupportMapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);
        mSupportMapFragment.getMapAsync(this);

        mGeocoder = new Geocoder(this, Locale.getDefault());
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_main1, menu);
        return true;
    }

    @Override
    protected void onPause() {
        super.onPause();
        stopLocationUpdates();

        Geocoder geocoder = new Geocoder(this, Locale.getDefault());
    }

    protected void stopLocationUpdates() {
        LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, (LocationListener) this);
    }    

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.normal:
                mGoogleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
                break;
            case R.id.satellite:
                mGoogleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
                break;
            case R.id.terrain:
                mGoogleMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
                break;
            case R.id.hybrid:
                mGoogleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
                break;
            case R.id.none:
                mGoogleMap.setMapType(GoogleMap.MAP_TYPE_NONE);
                break;
        }

        return true;
    }

    @Override
    public void onMapReady(GoogleMap googleMap) {
        mGoogleMap = googleMap;
        mGoogleMap.getUiSettings().setZoomControlsEnabled(true);
        mGoogleMap.getUiSettings().setCompassEnabled(true);
        mGoogleMap.getUiSettings().setMyLocationButtonEnabled(true);
        mGoogleMap.setMyLocationEnabled(true);
        mGoogleMap.setOnMyLocationChangeListener(this);

        showMyLocationOnScreen();
    }

    @Override
    public void onMyLocationChange(Location location) {
        showMyLocationOnScreen();
    }

    private void showMyLocationOnScreen() {

        double lat = 28.666667;
        double lon = 71.216667;

        Toast.makeText(this, lat + "\n" + lon, Toast.LENGTH_LONG).show();

        LatLng latLng = new LatLng(lat, lon);

        mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 13));

        mGoogleMap.addMarker(new MarkerOptions()
                .title("India")
                .snippet("The capital city")
                .position(latLng));

        try {
            List<Address> addresses = mGeocoder.getFromLocation(lat, lon, 5);

            if (addresses != null && addresses.size() > 0) {
                for (Address address : addresses) {
                    StringBuilder stringBuilder = new StringBuilder();
                    for (int i = 0; i < address.getMaxAddressLineIndex(); i++) {
                        stringBuilder.append(address.getAddressLine(i));
                        stringBuilder.append("\n");
                    }
                    Log.i("edureka", stringBuilder.toString());
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onLocationChanged(Location location) {

    }

    @Override
    public void onStatusChanged(String s, int i, Bundle bundle) {

    }

    @Override
    public void onProviderEnabled(String s) {

    }

    @Override
    public void onProviderDisabled(String s) {

    }
}
这是我的清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.lenovo.googlemaps">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.MAPS_RECIEVE"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
    <uses-library android:name="com.google.android.maps"/>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <!--
 The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
         Google Maps Android API v2, but are recommended.
    -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-feature android:glEsVersion="0x00020000"
        android:required="true"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <activity
            android:name=".MapsActivity"
            android:label="GoogleMaps" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyCN6pHntLjsD6PGmu9UMkWNyY3O8071oIo"/>
    </application>

</manifest>

你收到了什么错误消息?实际上有很多错误消息正在显示,其中之一是它说,无法连接到谷歌APIE/GMSWearables﹕ GoogleAppClient连接失败:ConnectionResult{statusCode=API_不可用,resolution=null,message=null}显示的其他错误为:09-25 02:53:54.214 738-738/?E/GpsLocationProvider﹕ set_AGPS_服务器中没有AGPS接口09-25 02:53:54.214 738-738/?E/GpsLocationProvider﹕ 配置更新E/wpa请求者中没有GPS配置接口﹕ 第1行:太长型号名称长度=42最大长度=32 09-25 02:53:50.862 1145-1145/?E/wpa\U请求人﹕ 第1行:未能分析“model_name=Google Nexus 4-5.1.0-API 22-768x1280”。