2013-03-13 23 views
0

我已經完成了谷歌播放所需的所有設置。但我的Eclipse模擬器給我錯誤「不幸的是你的com.vogella .. ..停止」 請建議我的解決方案,以便我可以檢查我的谷歌地圖的示例代碼是否工作。谷歌播放地圖應用程序不在月食中工作

我ShowMapActivity.java文件

package com.vogella.android.locationapi.maps; 

import android.app.Activity; 
import android.os.Bundle; 
import android.view.Menu; 

import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.MapFragment; 
import com.google.android.gms.maps.model.BitmapDescriptorFactory; 
import com.google.android.gms.maps.model.LatLng; 
import com.google.android.gms.maps.model.Marker; 
import com.google.android.gms.maps.model.MarkerOptions; 

@SuppressWarnings("unused") 
public class ShowMapActivity extends Activity { 
static final LatLng HAMBURG = new LatLng(53.558, 9.927); 
static final LatLng KIEL = new LatLng(53.551, 9.993); 
private GoogleMap map; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
setContentView(R.layout.activity_show_map); 
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)) 
    .getMap(); 
// Move the camera instantly to hamburg with a zoom of 15. 
map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15)); 

// Zoom in, animating the camera. 
map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); 
} 

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

} 

我activity_show_map 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" > 

<fragment 
    android:id="@+id/map" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    class="com.google.android.gms.maps.MapFragment" /> 

</RelativeLayout> 


AnrdoidManifest.xml file 

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.vogella.android.locationapi.maps" 
android:versionCode="1" 
android:versionName="1.0" > 

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

<permission 
    android:name="com.vogella.android.locationapi.maps.permission.MAPS_RECEIVE" 
    android:protectionLevel="signature" /> 

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

<uses-permission   android:name="com.vogella.android.locationapi.maps.permission.MAPS_RECEIVE" /> 
<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> 
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 

<application 
android:allowBackup="true" 
android:icon="@drawable/ic_launcher" 
android:label="@string/app_name" 
android:theme="@style/AppTheme" > 
<activity 
android:name="com.vogella.android.locationapi.maps.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.maps.v2.API_KEY" 
     android:value="AIzaSyBIVouPmUMc0-EDPtQwqgzVcwlEt9NlaIo" /> 
</application> 

回答

0

谷歌地圖Android版API不會在模擬器中運行外的箱子。有些人使用一些技巧來解決問題,但我自己卻不幸。

您可以通過this post自己嘗試一下,祝你好運! ...或使用真實的設備。

0

即使我沒有任何運氣在模擬器上運行地圖。但是在真實的設備上它應該可以正常工作。

There are some steps here.. Hope it helps

一些梗概

安裝谷歌服務包;大湄公河次區域和自動售貨機

Be sure that emulator started Copy attached com.google.android.gms-19032013.apk and com.google.android.vending-19032013.apk files to <bundel root>\sdk\platform-tools 
    Open command from and go to <bundel root>\sdk\platform-tools 
    then run command adb install com.google.android.gms-19032013.apk 


then run command adb install com.android.vending-19032013.apk 
if it says already exits then run commands 
    adb uninstall com.android.vending 
    adb uninstall com.google.android.gms 

想這將幫助:)

+0

注意,鏈接只有答案在這裏氣餒上,重新啓動您的ADB。請考慮[編輯您的答案](http://meta.stackexchange.com/a/8259/186599)並在此處添加摘要。 – NAZIK 2013-06-18 06:15:16

+0

好的。我會在下次:) – 2013-06-18 07:06:41

0

我試圖運行它們使用谷歌在模擬器玩服務的應用程序,它的工作原理

首先創建Android模擬器與API級18(安卓4.3)

的你要下載兩個APK :

1)谷歌玩APK命名com.android.vending.apk(尋求最新的版本)

2)谷歌播放服務命名com.google.android.gms.apk(尋求最新的版本)

然後安裝在您的模擬器這兩個APK剛剛創建:

打開您的控制檯,然後去你的SDK的平臺工具文件

寫那些命令insatall APK

ADB安裝com.android.vending.apk

然後

ADB安裝ç om.android.vending。APK

與此命令

亞行重啓

啓動您的應用程序希望,它的工作

相關問題