Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android:Google Maps V2没有运行兼容设备_Java_Android_Google Maps_Google Maps Android Api 2_Android 2.3 Gingerbread - Fatal编程技术网

Java Android:Google Maps V2没有运行兼容设备

Java Android:Google Maps V2没有运行兼容设备,java,android,google-maps,google-maps-android-api-2,android-2.3-gingerbread,Java,Android,Google Maps,Google Maps Android Api 2,Android 2.3 Gingerbread,首先,我使用以下设置配置了AVD: 设备:3.7英寸480x800:hdpi 目标:谷歌API(谷歌公司)-API等级10 内存:512 虚拟机堆:32 SD卡:10MIB 仿真选项:快照 我正在尝试运行一个简单的地图。AVD正在运行,但当我尝试运行应用程序时,它会说:“没有找到兼容的目标。是否要添加新的Android虚拟设备?“Android-support-v4.jar位于我的libs文件夹中 这是我的AndroidManifest.xml <?xml version="1.0"

首先,我使用以下设置配置了AVD:

  • 设备:3.7英寸480x800:hdpi
  • 目标:谷歌API(谷歌公司)-API等级10
  • 内存:512
  • 虚拟机堆:32
  • SD卡:10MIB
  • 仿真选项:快照
我正在尝试运行一个简单的地图。AVD正在运行,但当我尝试运行应用程序时,它会说:“没有找到兼容的目标。是否要添加新的Android虚拟设备?“Android-support-v4.jar位于我的libs文件夹中

这是我的AndroidManifest.xml

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

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

<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-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" >
    <activity
        android:name="com.example.maps.Main"
        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="#################################"/>
</application>

我遗漏了什么?

你的项目构建目标是什么?确保它必须是google API min sdk是10。构建目标是google API sdk 18。我读得越多,就越意识到我似乎无法在模拟器上运行它。显然,Maps v2需要播放服务,而不会在模拟器上运行。这太愚蠢了。我需要这样做支持设备回到gingerbread。为了测试我需要仿真支持。为了让它真正接受AVD,我不得不将构建目标更改为Google API for SDK 10。一旦我这样做了,它就加载了,但它说如果没有Google play服务,它就不能在手机上运行,而Google play服务不能安装在运行其他功能的模拟器上HAT4.2.2.所以我要再说一遍,当开发人员不能在旧的模拟器上运行应用程序时,他/她应该如何检查兼容性?
<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=".Main" >

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

</RelativeLayout>
package com.example.maps;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;

public class Main extends FragmentActivity {

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

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

}