2013-04-24 4 views
2

Я собираюсь внедрить карту google в моем приложении, но я сталкиваюсь с какой-то проблемой, когда запускаю свой код, он дает ошибку. ошибкаAndroid google map apiv2

Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY

  • Я добавил Google playservices.lib
  • я сгенерировал SHA1 ключ-й ключ API также.

помощь в помощи.

mainActivity.java

package com.example.mapdemo; 

import com.google.android.gms.common.ConnectionResult; 
import com.google.android.gms.common.GooglePlayServicesUtil; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.SupportMapFragment; 

import android.app.AlertDialog; 
import android.os.Bundle; 
import android.support.v4.app.FragmentActivity; 
import android.support.v4.app.FragmentManager; 
import android.view.Menu; 
import android.view.MenuItem; 
import android.widget.Toast; 

public class MainActivity extends FragmentActivity { 

final int RQS_GooglePlayServices = 1; 
private GoogleMap myMap; 

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

    FragmentManager myFragmentManager = getSupportFragmentManager(); 
    SupportMapFragment mySupportMapFragment 
    = (SupportMapFragment)myFragmentManager.findFragmentById(R.id.map); 
    myMap = mySupportMapFragment.getMap(); 


    myMap.setMyLocationEnabled(true); 
} 

} 

XML

<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" 
    tools:context=".MainActivity" > 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_centerVertical="true" 
     android:text="@string/hello_world" /> 
    <fragment 
     android:id="@+id/map" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     class="com.google.android.gms.maps.SupportMapFragment"/> 

</RelativeLayout> 

манифеста

<?xml version="1.0" encoding="utf-8"?> 

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

     <uses-sdk 
      android:minSdkVersion="8" 
      android:targetSdkVersion="17" /> 
     <uses-permission android:name="android.permission.INTERNET"/> 
     <uses-permission 
      android:name="com.example.mapdemo.permission.MAPS_RECEIVE"/> 
     <uses-permission 
      android:name="com.example.mapdemo.permission.MAPS_RECEIVE"/> 
     <uses-permission 
      android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"> 

     </uses-permission> 
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> 
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 

     <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.maps.v2.API_KEY" 
    android:value="AIzaSyBVp6mYyD23IrW7POWAvrY2YzL8q3zaYXU"/> 
      <activity 
       android:name="com.example.mapdemo.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> 
     </application> 

    </manifest> 
+0

У вас есть протестировать этот код на устройстве Android или в эмуляторе ?? также проверьте на своем устройстве карту google? –

+0

Где вы используете приложение на устройстве или эмуляторе? – wrecker

+0

http://stackoverflow.com/questions/1113088/install-failed-missing-shared-library-error-in-android –

ответ

0

Попробуйте следующее Ste p ниже. Для меня, я думаю, вы пропустили шаг 4: «добавьте библиотеку google play».

To add the dependency to Google Play Services into your project 
Project -> Properties -> Android -> Library, Add -> google-play-services_lib 
+0

Я добавил (а) эту услугу –