灰色瓷砖Android谷歌地图模拟器

时间:2013-01-15 10:38:27

标签: android maps emulation tiles

第一个问题。

当我在Android模拟器中构建应用程序而不是显示Google地图的地图时,它会显示空的灰色瓷砖。

我做过的事情:

  • 我添加了Google API Sdk。
  • 项目目标是Android + Google API(Google Apis)。
  • 我使用GPS创建了一个带有目标Google Apis的新模拟器,并将RAM和max vm应用程序堆增加到512和48.
  • 我删除了debug.keystore和default.keyset 2000次并重建密钥并发送给Google 2000次以上仍然无法正常工作。
  • 我获取SHA1的命令如下:

    ./ keytool.exe -list -v -keystore /home/q/my_name/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

然后我获取sha1并粘贴到谷歌并添加分号和应用程序名称,所以:

E4:A ..... C38;com.example.myappname

好的,那我的代码:

主要活动:

package com.example.rest;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;

public class Rest extends MapActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rest);
        MapView mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
    }

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

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_rest, menu);
        return true;
    }

    public void onProviderDisabled(String provider) {
        Intent intent = new Intent( android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
        startActivity(intent);
    }
}

清单:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.rest"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <uses-permission android:name="android.permission.INTERNET"/>    
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application
        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=".Rest"
            android:label="@string/title_activity_rest" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

布局:

<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" >

<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="AIzaSyAdh38-k34RPi7aQ4ik6ExKKWI-wS-bDJA"
/>

</RelativeLayout>

重要的事情:

  • 预建地图应用程序WORKS。
  • sdk示例(com.example.android.apis.MapsDemo)不起作用,因为显示灰色的图片。

任何线索?问我关于我的问题你需要什么,我会回答。

(我编辑了应用名称和一些不能显示有关我姓名等的真实数据的事情。)

logcat的:

01-15 10:47:11.498: W/KeyCharacterMap(509): No keyboard for id 0
01-15 10:47:11.498: W/KeyCharacterMap(509): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
01-15 10:47:17.938: W/System.err(509): java.lang.IllegalStateException: Connection pool shut down.
01-15 10:47:18.068: W/System.err(509):  at org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(ConnPoolByRoute.java:284)
01-15 10:47:18.068: W/System.err(509):  at org.apache.http.impl.conn.tsccm.ConnPoolByRoute$1.getPoolEntry(ConnPoolByRoute.java:238)
01-15 10:47:18.068: W/System.err(509):  at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager$1.getConnection(ThreadSafeClientConnManager.java:175)
01-15 10:47:18.068: W/System.err(509):  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:325)
01-15 10:47:18.078: W/System.err(509):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
01-15 10:47:18.078: W/System.err(509):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
01-15 10:47:18.298: W/System.err(509):  at android_maps_conflict_avoidance.com.google.common.io.android.AndroidHttpClient.execute(AndroidHttpClient.java:246)
01-15 10:47:18.298: W/System.err(509):  at android_maps_conflict_avoidance.com.google.common.io.android.GoogleHttpClient.executeWithoutRewriting(GoogleHttpClient.java:129)
01-15 10:47:18.308: W/System.err(509):  at android_maps_conflict_avoidance.com.google.common.io.android.GoogleHttpClient.execute(GoogleHttpClient.java:189)
01-15 10:47:18.308: W/System.err(509):  at android_maps_conflict_avoidance.com.google.common.io.android.GoogleHttpClient.execute(GoogleHttpClient.java:242)
01-15 10:47:18.334: W/System.err(509):  at android_maps_conflict_avoidance.com.google.common.io.android.AndroidHttpConnectionFactory$AndroidGoogleHttpConnection.getResponse(AndroidHttpConnectionFactory.java:132)
01-15 10:47:18.334: W/System.err(509):  at android_maps_conflict_avoidance.com.google.common.io.android.AndroidHttpConnectionFactory$AndroidGoogleHttpConnection.openDataInputStream(AndroidHttpConnectionFactory.java:153)
01-15 10:47:18.348: W/System.err(509):  at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:922)
01-15 10:47:18.472: W/System.err(509):  at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
01-15 10:47:18.472: W/System.err(509):  at java.lang.Thread.run(Thread.java:1019)
01-15 10:47:19.038: W/MapActivity(509): Recycling dispatcher android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher@405e68e8
01-15 10:47:19.058: V/MapActivity(509): Recycling map object.
01-15 10:47:19.418: I/MapActivity(509): Handling network change notification:CONNECTED
01-15 10:47:19.418: E/MapActivity(509): Couldn't get connection factory client

我在Linux上,但我正在使用位于winxp分区上的keytool.exe。我不知道这是否会引起问题。但keytool.exe给了我sha1没有问题,我只是提到它是重要的。

编辑:问题解决了!正确的答案是由FIDO ,只是滚动你的屏幕。

1 个答案:

答案 0 :(得分:3)

您正在使用谷歌地图V2的密钥进行谷歌地图V1项目。尝试使用this获取Google地图V1的密钥