Android的地图在模拟器上不运行 [英] android map not running on the emulator
问题描述
嘿是有可能运行在模拟器上的Android地图的活动?因为I M得到的错误这个程序不会运行,除非您更新谷歌播放服务请回复其非常紧迫!我的code是如下:
MainActivity.java
包com.example.googlev2map;
进口android.app.Activity;
进口android.os.Bundle;
进口android.support.v4.app.FragmentActivity;
公共类MainActivity扩展FragmentActivity {
@覆盖
保护无效的onCreate(捆绑为arg0){
// TODO自动生成方法存根
super.onCreate(为arg0);
的setContentView(R.layout.activity_main);
}}
activity_main.xml中
<的RelativeLayout的xmlns:机器人=http://schemas.android.com/apk/res/android
的xmlns:工具=http://schemas.android.com/tools
机器人:layout_width =match_parent
机器人:layout_height =match_parent
工具:上下文=MainActivity。>
<片段
机器人:ID =@ + ID /片段1
机器人:layout_width =match_parent
机器人:layout_height =match_parent
类=com.google.android.gms.maps.SupportMapFragment/>
< / RelativeLayout的>
AndroidManifest.xml中
<?XML版本=1.0编码=UTF-8&GT?;
<清单的xmlns:机器人=http://schemas.android.com/apk/res/android
包=com.example.googlev2map
安卓版code =1
机器人:=的versionName1.0>
<用途-SDK
安卓的minSdkVersion =8
机器人:targetSdkVersion =17/>
<许可
机器人:名字=com.example.googlev2map.permission.MAPS_RECEIVE
安卓的ProtectionLevel =签名>< /许可>
<使用许可权
机器人:名字=com.example.googlev2map.permission.MAPS_RECEIVE/>
<使用许可权
机器人:名字=com.google.android.providers.gsf.permission.READ_GSERVICES/>
<使用许可权
机器人:名字=android.permission.INTERNET对/>
<使用许可权的android:NAME =android.permission.ACCESS_NETWORK_STATE/>
<使用许可权
机器人:名字=android.permission.WRITE_EXTERNAL_STORAGE/>
<使用许可权
机器人:名字=android.permission.ACCESS_COARSE_LOCATION/>
<使用许可权
机器人:名字=android.permission.ACCESS_FINE_LOCATION/>
<使用许可权的android:NAME =android.permission.ACCESS_MOCK_LOCATION/>
<用途特征
机器人:glEsVersion =0x00020000
机器人:要求=真/> <应用
机器人:allowBackup =真
机器人:图标=@绘制/ ic_launcher
机器人:标签=@字符串/ APP_NAME
机器人:主题=@风格/ AppTheme>
<活动
机器人:名字=com.example.googlev2map.MainActivity
机器人:标签=@字符串/ APP_NAME>
&所述;意图滤光器>
<作用机器人:名字=android.intent.action.MAIN/> <类机器人:名字=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT;
&所述;元数据
机器人:名字=com.google.android.maps.v2.API_KEY
机器人:值=AIzaSyAy2ThskwG3Q9ArpZR_GvJP5_5IWfcEJhU/>
<元数据机器人:名字=com.google.android.gms.version
机器人:值=@整数/ GOOGLE_PLAY_SERVICES_VERSION/> <元数据机器人:名字=com.google.android.gms.version机器人:值=@整数/ GOOGLE_PLAY_SERVICES_VERSION>
< /元数据>
<使用库
机器人:名字=com.google.android.maps
机器人:要求=真/> < /用途>< /清单>
这个程序不会运行,除非您更新谷歌播放服务
谷歌地图需要谷歌播放服务。
要测试您的应用使用谷歌Play服务SDK时,您必须使用:
-
在运行Android 2.3或更高,包括谷歌Play商店兼容的Android设备。
-
Android模拟器与AVD运行基于Android 4.2.2或谷歌API的平台更高。
所以,如果你仍然得到消息这个程序不会运行,除非您更新谷歌播放服务很显然,在其上尝试运行没有发挥谷歌安装的服务设备。所以,你需要测试安装谷歌播放33.060.99真实设备上
Hey is it possible to run the android map activity on the emulator?? because i m getting the error " this app wont run unless you update the Google play services" Please reply its very urgent!!My code is as follows :
MainActivity.java
package com.example.googlev2map;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle arg0) {
// TODO Auto-generated method stub
super.onCreate(arg0);
setContentView(R.layout.activity_main);
} }
activity_main.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/fragment1"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>
Androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googlev2map"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission
android:name="com.example.googlev2map.permission.MAPS_RECEIVE"
android:protectionLevel="signature"></permission>
<uses-permission
android:name="com.example.googlev2map.permission.MAPS_RECEIVE"/>
<uses-permission
android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<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="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_MOCK_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" >
<activity
android:name="com.example.googlev2map.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="AIzaSyAy2ThskwG3Q9ArpZR_GvJP5_5IWfcEJhU"/>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version">
</meta-data>
<uses-library
android:name="com.google.android.maps"
android:required="true" />
</application>
</manifest>
this app wont run unless you update the Google play services
Google map requires google play services.
To test your app when using the Google Play services SDK, you must use either:
A compatible Android device that runs Android 2.3 or higher and includes Google Play Store.
The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.
So if you still get the message "this app wont run unless you update the Google play services" it is clear that the device on which you are trying to run does not have google play services installed. So you need to test on a real device that has google play servies installed
这篇关于Android的地图在模拟器上不运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!