Google Maps for android无法呈现

ll

我最近将所有工具更新为sdk23。当我使用活动向导创建Google Maps Activity时,它会成功创建,但是当我在设备上运行它时,地图不会显示。我得到的只是左下角的google徽标。

我尝试过的

-使用debug.keystore中的SHA-1创建API密钥

-重新生成的API密钥和已验证的软件包名称

-确保我启用了“ Android版Google Maps v2”,而不是“ Google Maps v2”

-在该网站上查看并尝试了所有我可以找到的相关解决方案(+ -10),但没有一个起作用

-确保我将google-play-services作为项目依赖项

-确保Google Play服务已与其他工具一起更新

我的清单:

<!--
     The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
     Google Maps Android API v2, but you must specify either coarse or fine
     location permissions for the 'MyLocation' functionality. 
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<permission android:name="com.venon.ranger.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.venon.ranger.permission.MAPS_RECEIVE"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">

    </activity>

    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="AIzaxxxxxxxxxxxxxxxxxxxx" />

    <activity
        android:name=".MapsActivity"
        android:label="@string/title_activity_maps">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <receiver android:name=".PushReceiver">
        <intent-filter>

            <!-- Do not modify this -->
            <action android:name="pushy.me" />
        </intent-filter>
    </receiver>

    <!-- Pushy Update Receiver -->
    <!-- Do not modify - internal BroadcastReceiver that restarts the listener service -->
    <receiver android:name="me.pushy.sdk.receivers.PushyUpdateReceiver">
        <intent-filter>
            <action android:name="android.intent.action.PACKAGE_REPLACED" />

            <data android:scheme="package" />
        </intent-filter>
    </receiver>

    <!-- Pushy Boot Receiver -->
    <!-- Do not modify - internal BroadcastReceiver that restarts the listener service -->
    <receiver android:name="me.pushy.sdk.receivers.PushyBootReceiver">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>

    <!-- Pushy Socket Service -->
    <!-- Do not modify - internal socket background service -->
    <service android:name="me.pushy.sdk.services.PushySocketService" />
</application>

我的应用程序等级:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
    applicationId "com.venon.ranger"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
   compile fileTree(dir: 'libs', include: ['*.jar'])
   testCompile 'junit:junit:4.12'
   compile 'com.android.support:appcompat-v7:23.0.0'
   compile 'com.google.android.gms:play-services-maps:8.4.0'

}

我的MapActivity.xml

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:apiKey = "AIzaxxxxxxxxxxxxxxxxxxxxxxxxxx"
tools:context="com.venon.ranger.MapsActivity" />

我的MapActivity.java

package com.venon.ranger;

import android.os.Bundle; 
import android.support.v4.app.FragmentActivity;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

private GoogleMap mMap;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);



}


/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move the camera. In this case,
 * we just add a marker near Sydney, Australia.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    // Add a marker in Sydney and move the camera
    LatLng disturbance = new LatLng(-34, 151);

    mMap.addMarker(new MarkerOptions().position(disturbance).title("Disturbance"));
    mMap.moveCamera(CameraUpdateFactory.newLatLng(disturbance));

}
}

我没有主意。

Android发烧友

此问题通常与用于签署清单Maps API密钥有关在中创建API密钥时,需要确保使用调试密钥库Google API console

准备将应用程序启动到Market时,请在AndroidManifest.xml中设置android:debuggable =“ false”并使用Signed API key

使用签名的API密钥时,仅当从Android电子市场安装该应用程序时,MapView才会显示。因此,将显示MapView。

如果您在应用程序中有多个软件包,请注意在创建API密钥时必须使用android mainfest.xml文件顶部包含的软件包名称

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

这是一个相关的Stack溢出票证,其中讨论了Google Maps不呈现地图的情况:Android和来自Google的地图出现奇怪的错误

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

无法使用App脚本在Dialog中呈现Google Maps

来自分类Dev

Android Google Maps LocationClient

来自分类Dev

Android Google Maps图标

来自分类Dev

Android-Google Maps

来自分类Dev

无法在Android项目中实施Google Maps

来自分类Dev

Android Google Maps Marker无法立即更新

来自分类Dev

无法为Android Google Maps创建ClusterManager

来自分类Dev

无法在Android项目中实施Google Maps

来自分类Dev

无法在Android应用中添加Google Maps

来自分类Dev

Google Maps Marker无法删除

来自分类Dev

React Google Maps无法导入

来自分类Dev

Google Maps无法使用jQuery

来自分类Dev

Google Maps Javascript API 未呈现

来自分类Dev

无法与Flutter Web上的Google Maps互动(google_maps)

来自分类Dev

Android Google Maps按钮样式

来自分类Dev

Android Google Maps经/纬度

来自分类Dev

Android Google Maps:getLastLocation与requestLocationUpdates

来自分类Dev

Android Google Maps移动相机

来自分类Dev

Android Google Maps SnapshotReadyCallback错误

来自分类Dev

Google Maps for Android签名过程

来自分类Dev

Android Google Maps按钮样式

来自分类Dev

Android SDK Eclipse Google Maps

来自分类Dev

内插Google Maps Android道路

来自分类Dev

Android Google Maps,多个意图

来自分类Dev

地图标记无法呈现-Phonegap中的Google Maps Javascript API v3

来自分类Dev

Google Maps-无法加载Android应用-空对象引用

来自分类Dev

Mvvmcross Android Google Maps,无法绑定缩放级别

来自分类Dev

Google Maps Android Heatmap Utility教程-无法解决方法

来自分类Dev

版本中的Android Google Maps API无法正常工作