【发布时间】:2013-09-23 17:17:51
【问题描述】:
我现在一直在努力让 google maps for android V2 工作。 我正在设备上尝试这个:Samsung Galaxy S [2.3.3] 和模拟器。
我的清单: (我尝试过同时使用 Debug 键和 Release 键)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.klottr"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="18" />
<permission
android:name="com.example.klottr.permission.MAPS_RECEIVE"
android:protectionLevel="signature"></permission>
<uses-permission
android:name="com.example.klottr.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.WRITE_EXTERNAL_STORAGE"/>
<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" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDqmCXjO-h-Yy_qGsyVrUz_icB9mCTUzLM"/>
<activity
android:name="com.example.klottr.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>
mainactivity 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>
mainactivity java 文件:
package com.example.klottr;
import com.example.klottr.R;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class MainActivity extends FragmentActivity {
GoogleMap googleMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
我已尝试按照 google 网站上的指南以及 stackoverflow 中的一些指南和技巧进行操作。我非常感谢一些提示。 我现在只是想让我的设备正确显示地图,但我得到了 “除非您更新 Google Play 服务,否则此应用将无法运行”,即使我的设备上安装了最新版本的 Google Play 服务。
【问题讨论】:
-
您如何将 google play 服务库链接到项目中?
-
将现有的android代码导入工作区(/extras/google/google_play_services/libproject/google-play-services_lib)右键项目->属性->安卓->添加->选择google play服务库
-
您是否还看到了 Android Private Libraries 和 Android Dependencies 下的 google play jar?我问是因为我基本上有同样的问题,我看到了。不确定这是否正确,但似乎没有任何办法没有它。另外,你是在导入的时候把项目复制到工作区吗?
-
将项目复制到工作区:是实际上在 Android 私有库中:google-play-services.jar(位于 ../google-play-services_lib/libs 在 Android 依赖项中:google-play-services_lib.jar (位于 ../google-play-services_lib/bin
-
订购和出口标签怎么样?而且,需要明确的是,您没有看到 Adnroid Dependencies 下的 jar,只是 Android Private Libraries,对吗?等等,没关系,只是重读你的评论,呃。对不起
标签: java android eclipse google-maps google-maps-api-2