【问题标题】:Google Maps API in Android--using a proxy serverAndroid 中的 Google Maps API——使用代理服务器
【发布时间】:2011-10-24 05:34:57
【问题描述】:

我正在尝试使用 Google 地图开发一个简单的应用程序。 在运行应用程序时,我只能看到网格和地图控件。 我确实获得了一个 API 密钥并将其包含在 main.xml 文件中。 互联网的权限也在 androidmanifest.xml 中授予。 我在 avd 中的浏览器正在连接到互联网,当我在 avd 中运行本机地图应用程序时,它显示以下错误。

**网络故障 ... 错误的远程字符串版本。GMM 服务器必须托管:/strings_remote_533149424.dat**

GoogleMapActivity.java

package com.example.googlemap;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

public class GoogleMapActivity extends MapActivity
{
 @Override
 public void onCreate(Bundle savedInstanceState)
 {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);

 MapView mapView = (MapView) findViewById(R.id.mapview);
 mapView.setBuiltInZoomControls(true);


 }
 @Override
 protected boolean isRouteDisplayed()
 {
 return false;
 }
}

main.xml

<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
    android:apiKey="0kuSQz9hsxal-_JpKGJbFp__zLqhl5d4gG3ohDg"
/>

manifest.xml

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


   <application android:icon="@drawable/icon" android:label="@string/app_name">
   <activity android:name=".GoogleMapActivity" 
  android:label="@string/app_name"
  android:theme="@android:style/Theme.NoTitleBar">
      <intent-filter>
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter>
     </activity>
     <uses-library android:name="com.google.android.maps" /> 
    <uses-permission android:name="android.permission.INTERNET" /> 
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
     </application>

      </manifest>

我正在使用代理连接到互联网。 任何人都可以帮我解决这个问题..请帮帮我!!

【问题讨论】:

    标签: android google-maps proxy


    【解决方案1】:

    据我对 GoogleMaps 的了解,手册中没有说明代理是否对显示地图很重要。如果您有地图控件和 GoogleMap 网格,这意味着您已连接到地图服务器,但地图图块权限被拒绝。该怎么办: 1.检查是否有DEBUG键或Release键 2. 如果您使用从 PC 下载的“apk”进行本地测试,请使用 Debug 键 3. 如果您正在调试从 Android 市场下载的“apk”,请使用 Release 键 看起来您遇到了一个瓶颈。

    如果这些指示不起作用,请在此论坛上显示您的设置和源代码,以便其他人做出适当的反应。

    【讨论】:

      【解决方案2】:

      您是否在清单中设置了此权限:android.permission.ACCESS_FINE_LOCATION、android.permission.ACCESS_COARSE_LOCATION 和应用程序???

      【讨论】:

        【解决方案3】:

        我重新审视了您的问题,发现了 2 个可能的缺陷。

        1. 如下重写清单文件。 USES-PERMISSION 标签应该在 APPLICATION 标签之外。
        2. 您可能使用了错误的调试密钥。请根据手册生成一个新的调试密钥,以便在开发 PC 上与此应用程序一起使用。
        3. 如果问题仍然存在,请将您的开发环境更新到最新版本并重新测试。

        重写后的 manifest.xml 应如下所示:

        <?xml version="1.0" encoding="utf-8"?>
        <manifest xmlns:android="http://schemas.android.com/apk/res/android"
              package="com.example.googlemap"
              android:versionCode="1"
              android:versionName="1.0">
            <uses-sdk android:minSdkVersion="10" />
            <uses-permission android:name="android.permission.INTERNET" /> 
             <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
        
        
           <application android:icon="@drawable/icon" android:label="@string/app_name">
             <uses-library android:name="com.google.android.maps" /> 
           <activity android:name=".GoogleMapActivity" 
          android:label="@string/app_name"
          android:theme="@android:style/Theme.NoTitleBar">
              <intent-filter>
              <action android:name="android.intent.action.MAIN" /> 
              <category android:name="android.intent.category.LAUNCHER" /> 
              </intent-filter>
             </activity>
             </application>
        
              </manifest>
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-11-23
          相关资源
          最近更新 更多