元数据标记在googlemap v2中没有正确的值

时间:2014-10-10 23:07:13

标签: android google-maps

我正在尝试使用Google Play服务在我的应用程序中使用Google地图。得到错误 “java.lang.IllegalStateException:应用程序的AndroidManifest.xml中的元数据标记没有正确的值。预期4323000但找到5077000.您必须在元素中包含以下声明:”

但我添加了它并没有解决方案,这是错误的

MainActivity

public class MainActivity extends FragmentActivity implements OnClickListener,
android.location.LocationListener{
GoogleMap map;
Button bmap, bsatelite, bhybrid;
TextView header;
LatLng my_Position = new LatLng(0, 0);
LatLng my_prev_Position = new LatLng(0, 0);
double my_Latitude = 0;
double my_Longitude = 0;
LocationManager locationManager;
int location_findcounter = 0;
String provider = "";
Boolean Start;
static boolean placeshow = false;
HashMap<String, String> mMarkerPlaceLink = new HashMap<String, String>();
CheckBox chckboxanimatetomylocation;
Marker mark;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    bmap = (Button) findViewById(R.id.btnMap);
    // header = (TextView) findViewById(R.id.header);
    bsatelite = (Button) findViewById(R.id.btnsatelite);
    bhybrid = (Button) findViewById(R.id.btnhibrid);
    chckboxanimatetomylocation=(CheckBox)findViewById(R.id.checkBoxanimatetomylocation);
    bmap.setOnClickListener(this);
    bsatelite.setOnClickListener(this);
    bhybrid.setOnClickListener(this);

    int status = GooglePlayServicesUtil
            .isGooglePlayServicesAvailable(getBaseContext());

    if (status != ConnectionResult.SUCCESS) { // Google Play Services are
                                                // not available
        int requestCode = 10;
        Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this,
                requestCode);
        dialog.show();

    } else {
        //SupportMapFragment fragment = (SupportMapFragment)  getSupportFragmentManager()
            //  .findFragmentById(R.id.map);

        // Getting Google Map
    //  map = fragment.getMap();
        map.setOnMyLocationButtonClickListener(new OnMyLocationButtonClickListener() {

            @Override
            public boolean onMyLocationButtonClick() {
                // TODO Auto-generated method stub
                map.moveCamera(CameraUpdateFactory.newLatLng(my_Position));
                map.animateCamera(CameraUpdateFactory.zoomTo(17));

                return false;
            }
        });
    }
    if (map != null) {
        map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
        bsatelite.setEnabled(true);
        bsatelite.setTextColor(Color.BLACK);
        bhybrid.setEnabled(true);
        bhybrid.setTextColor(Color.BLACK);
        map.setMyLocationEnabled(true);
        Start = true;
        // Getting LocationManager object from System Service
        // LOCATION_SERVICE
        locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);

        // Creating a criteria object to retrieve provider
        Criteria criteria = new Criteria();

        // Getting the name of the best provider
        provider = locationManager.getBestProvider(criteria, true);

        // Getting Current Location From GPS
        Location location = locationManager.getLastKnownLocation(provider);

        if (location != null) {
            onLocationChanged(location);
        } else {
            Toast.makeText(getApplicationContext(),
                    "Please make The GPS ON", Toast.LENGTH_LONG).show();
        }
    }
}

主要布局

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
tools:context="com.Dawarly.Main_activity" >

<fragment
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:layout_below="@+id/checkBoxanimatetomylocation"/>
</RelativeLayout>

mainifist文件

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.Walkwithme.View"
android:versionCode="1"
android:versionName="1.0" >

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

<permission
    android:name="com.Walkwithme.View.MAPS_RECIEVE"
    android:protectionLevel="signature" >
</permission>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<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" />
<!--
 The following two 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" />

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

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <uses-library android:name="com.google.android.maps" />
    <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="AIzaSyCBv2SIJN6_sIqI_68iu8yYFnsRBDQVie4" />
    <activity
        android:name="MainActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />                
        </intent-filter>
    </activity>

    <activity
        android:name="About"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:value="com.Walkwithme.View.MainActivity" >

        <!-- Parent activity meta-data to support API level 7+ -->
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.Walkwithme.View.MainActivity" />
    </activity>

</application>

0 个答案:

没有答案