android - Google map 没有空图 block 、没有 map 、没有 LogCat 错误。 map API V2 6/2013

标签 android google-maps android-manifest

我的 map 不会显示。我什至没有在 Log Cat 中看到 map 网格或任何错误消息。我没有收到任何类型的“无法通过 google api 进行身份验证”或类似的信息(这让我相信我的 api key 是正确的)。我根本没有得到任何类型的 map 。

配置和 list

  1. 我正在使用 Android 模拟器(我检索了调试 key 来生成 API key ,因为我没有将其导出为 apk)
  2. 我从 jdk1.7 正确获取了 SHA1 并调试 keystore
  3. 我在 API 开发者控制台上启用了 GoogleMaps V2 和 GooglMapsAndroidV2
  4. 我启用了所有必需和推荐的权限、元数据和功能(例如 openGL 2),如下我的 list 中所示
  5. 我已启用 Android PrivateLibraries A。谷歌播放服务.jar b. Android-support-v4.jar
  6. 我有 Android 依赖项: A。 Google-play-services_lib.jar
  7. 我已在本文底部复制了我的 project.properties 和 proguard 文件

enter image description here

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

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="17" />

    <permission
        android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>

    <uses-permission android:name="com.example.proximitystuff.permission.MAPS_RECEIVE"/>

    <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"/>
    <!-- The following two permissions are not required to use
         Google Maps Android API v2, but are recommended. -->
    <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">

        <uses-library
            android:name="com.google.android.maps"/>
        <activity
            android:name="com.example.proximitystuff.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>

         <activity
            android:name="com.example.proximitystuff.MyMapActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAPACTIVITY" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <service
            android:name="com.example.proximitystuff.ProxyBackgroundCheck"
            android:enabled="true"
            android:permission="com.example.ADAMS_PROX_PERMISSION" >
        </service>

       <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyBnQNgn166qfatch_xcFwL8K0AfVHBYcGA"/>

    </application>

</manifest>

Java 代码和 XML 布局: 我的主要 Activity 使用一个按钮进入屏幕截图中显示的 map Activity 。此 map Activity 的代码仅限于最基本的功能,但它仍然无法工作。我的一个理论是,由于此类不继承自“FragmentActivity”,因此它无法使用 xml fragment (如果是这种情况,我希望我至少会在日志中收到某种类型的错误)。

package com.example.proximitystuff;


import android.app.Activity;
import android.os.Bundle;


public class MyMapActivity extends Activity {


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

My XML layout is using the most basic layout possible. 
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/map"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:name="com.google.android.gms.maps.MapFragment"/>

enter image description here

项目.属性

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-17
android.library.reference.1=../google-play-services_lib

Proguard(以防万一这是错误的):

# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}
-keep class * extends java.util.ListResourceBundle {

protected Object[][] getContents();

}

最佳答案

I am using the android emulator

据我所知,Android 模拟器不支持 Maps V2 或任何涉及 Play 服务的内容。虽然他们已经宣布了解决方案,但我不知道更新的图像已经发布。

关于android - Google map 没有空图 block 、没有 map 、没有 LogCat 错误。 map API V2 6/2013,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17074676/

相关文章:

android - 您通常如何向 Android 中的当前 Activity 添加 View ?

android - 找不到 firebase :crash-plugin:1. 1.0

javascript - 使用 javascript 从 Firebase 添加地点到热图

java - 请我需要有关 list 合并失败并出现多个错误的解决方案

java - 如何以编程方式填充 Android Manifest 元数据值?

android - 来电期间 Nexus 6 上未显示 Toast 消息

java - 以字符串形式将联系人作为 vCard 启动 Intent

javascript - 您是否需要为客户端应用程序使用 google maps API 的 API key ?

java - 在我的应用程序中出现错误 "java.lang.RuntimeException: Unable to start activity"

android:应用程序不支持设备 - 为什么?