Google 地图 Api v2 Android 错误

Google Maps Api v2 Android Error

只有 Android 5.0 有效。 错误 Android 5.0 低

我已经安装了所有的SDK包。

清单

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

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="19" />

    <permission
        android:name="com.allegretti.triestebus.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <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" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
    <!--
 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_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />







    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.Triestebus" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <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.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="@string/google_maps_key" />

        <activity
            android:name=".MapsActivity"
            android:label="@string/title_activity_maps" >
        </activity>
    </application>

</manifest>

build.grade

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.allegretti.triestebus"
        minSdkVersion 16
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.google.android.gms:play-services:7.0.0'
}

Java class

public class Fragment2 extends Fragment {
     MapView mMap;
     GoogleMap googleMap;
    View rootView;

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){

       rootView = inflater.inflate(R.layout.activity_maps, container, false);
        mMap = (MapView) rootView.findViewById(R.id.mapView);

        mMap.onCreate(savedInstanceState);

        googleMap = mMap.getMap();
//        googleMap.getUiSettings().setMyLocationButtonEnabled(false);
//        googleMap.setMyLocationEnabled(true);


        // Needs to call MapsInitializer before doing any CameraUpdateFactory calls
        MapsInitializer.initialize(this.getActivity());

        // Updates the location and zoom of the MapView
//        CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(45.649526, 13.776818), 13);
       // googleMap.animateCamera(cameraUpdate);



      /*  googleMap.addMarker(new MarkerOptions().position(new LatLng(45.631523, 13.780745)).title("Fermata di Via Svevo").snippet("1-8-29-B"));
        googleMap.addMarker(new MarkerOptions().position(new LatLng(45.641204, 13.774329)).title("Fermata di Via Leon Battista Alberti").snippet("29-B"));
        googleMap.addMarker(new MarkerOptions().position(new LatLng(45.628215, 13.820757)).title("Fermata di Via Alpi Giulie").snippet("37-48-C"));
        googleMap.addMarker(new MarkerOptions().position(new LatLng(45.639983, 13.758070)).title("Fermata di Passeggio Sant'Andrea").snippet("8-9-A"));
        googleMap.addMarker(new MarkerOptions().position(new LatLng(45.627767, 13.810545)).title("Fermata di Via Erta Sant'Anna").snippet("34"));
*/
        return (rootView);

    }
    public void onResume() {

        super.onResume();

        mMap.onResume();

    }

    @Override

    public void onPause() {

        super.onPause();

        mMap.onPause();

    }

    @Override

    public void onDestroy() {

        super.onDestroy();

        mMap.onDestroy();

    }

    @Override

    public void onLowMemory() {

        super.onLowMemory();

        mMap.onLowMemory();

    }







}

错误

VFY: unable to resolve instance field 16
04-15 16:23:18.943    1791-1791/com.allegretti.triestebus D/dalvikvm﹕ VFY: replacing opcode 0x54 at 0x00b3
04-15 16:23:18.953    1791-1791/com.allegretti.triestebus E/dalvikvm﹕ Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
04-15 16:23:18.953    1791-1791/com.allegretti.triestebus W/dalvikvm﹕ VFY: unable to resolve check-cast 25 (Landroid/app/AppOpsManager;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
04-15 16:23:18.953    1791-1791/com.allegretti.triestebus D/dalvikvm﹕ VFY: replacing opcode 0x1f at 0x000e
04-15 16:23:18.963    1791-1791/com.allegretti.triestebus I/dalvikvm﹕ Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzg
04-15 16:23:18.963    1791-1791/com.allegretti.triestebus W/dalvikvm﹕ VFY: unable to resolve virtual method 497: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
04-15 16:23:18.963    1791-1791/com.allegretti.triestebus D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000b
04-15 16:23:18.983    1791-1791/com.allegretti.triestebus W/GooglePlayServicesUtil﹕ Google Play services out of date.  Requires 7095000 but found 3136130
04-15 16:23:18.993    1791-1791/com.allegretti.triestebus W/GooglePlayServicesUtil﹕ Google Play services out of date.  Requires 7095000 but found 3136130
04-15 16:23:19.033    1791-1791/com.allegretti.triestebus W/GooglePlayServicesUtil﹕ Google Play services out of date.  Requires 7095000 but found 3136130
04-15 16:23:19.043    1791-1791/com.allegretti.triestebus W/GooglePlayServicesUtil﹕ Google Play services out of date.  Requires 7095000 but found 3136130
04-15 16:23:19.053    1791-1791/com.allegretti.triestebus W/GooglePlayServicesUtil﹕ Google Play services out of date.  Requires 7095000 but found 3136130

Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误 Google 地图 Api v2 Android 错误

因为 Google 地图 Android API 的版本 2 需要 OpenGL ES 版本 2,您必须在 AndroidManifest.xml 中添加一个元素作为清单元素的子元素:

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

这会将要求通知给外部服务。特别是,它可以防止 Google Play 商店在不支持 OpenGL ES 版本 2 的设备上显示您的应用程序。

您还没有在您的清单中进行此项添加。这是版本 2 所必需的。可能是因为这个原因,某些设备上的应用程序 运行 出现了特殊情况。
在您的代码中,确保您放置了用于检查是否也安装了播放服务的代码。按照官方文档中的步骤进行https://developers.google.com/maps/documentation/android