我有我的三星 siii 通过 USB 连接到 Eclipse 并用它来运行我的程序。我已经创建了一个基本的谷歌地图程序,并试图通过 eclipse 在我的手机上运行。我已经在 Windows -> Preferences -> android -> build 下从 eclipse 复制了 sha1 代码
并从网站上获得了谷歌密钥。以下是我的清单文件
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<permission
android:name="com.example.chaplbs.permission.MAPS_RECEIVE"
android:protectionLevel="signature"></permission>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-permission android:name="com.example.chaplbs.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<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" />
<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"/>
<activity
android:name="com.example.chaplbs.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="mykey"/>
</application>
以下是我的布局
<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<com.google.android.maps.MapView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/map"
android:clickable="true"
android:apiKey="my key"
android:enabled="true"
/>
</RelativeLayout>
但是在运行程序时出现以下错误:
06-20 15:23:51.262: W/System.err(28660): java.io.IOException: Server returned: 3
06-20 15:23:51.272: W/System.err(28660): at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
06-20 15:23:51.272: W/System.err(28660): at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
06-20 15:23:51.272: W/System.err(28660): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
06-20 15:23:51.272: W/System.err(28660): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
06-20 15:23:51.272: W/System.err(28660): at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
06-20 15:23:51.272: W/System.err(28660): at java.lang.Thread.run(Thread.java:1019)
我试图找出问题所在。我是否在我的手机上运行程序而不是模拟器产生此错误。请更新谢谢tejinder