2016-04-23 16 views
0

私は最近、すべてのツールをsdk 23に更新しました。アクティビティウィザードを使用してGoogleマップアクティビティを作成すると正常に作成されますが、デバイス上で実行すると地図は表示されません。私が得るのは左下隅にGoogleのロゴだけです。Googleの地図はレンダリングされていません

debug.keystoreで見つかったSHA-1を使用して

-Create APIキーが

-Regenerated APIキーと検証パッケージ名

i「はグーグルを有効にメイドは確か:私が試した何

地図のAndroid用V2」とない 『Googleマップv2の』

-Lookedで、私は見つけることができる、このサイト上のすべての関連のソリューションを試してみました(+ - 10)、のいずれもが

を働いていません10

メイドの確認I持っていたグーグル・プレイ・サービスを、プロジェクトの依存関係として

メイドの確認Googleのサービスは、ツール

私のマニフェストの残りの部分と一緒に更新されたプレイ:

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

私のApp-のGradle:

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)); 

} 
} 

私はアイデアの新鮮なうちです。

答えて

1

この問題は通常、マニフェストに署名するのに使用されるMaps API Keyに関連しています。 Google API consoleにAPIキーを作成するときは、必ずデバッグキーストアを使用する必要があります。

マーケットにアプリを起動する準備ができたら、AndroidManifest.xmlにandroid:debuggable="false"を設定し、Signed API keyを使用します。

署名されたAPIキーを使用すると、アプリがAndroidマーケットからインストールされたときにのみMapViewが表示されます。したがって、MapViewが表示されます。

アプリで複数のパッケージを持っている場合、あなたはアンドロイド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" > 

の上部に含まれたパッケージ名を使用する必要がありますAPIキーを作成するときに注意するには、関連するスタックオーバーフローチケットだましたAndroid and strange error with maps from google

+1

'署名されたAPIキーを使用すると、アプリがAndroidマーケットからインストールされたときにのみMapViewが表示されます。したがって、MapViewが表示されます。複数の証明書を単一のAPIキーに割り当てることができるので、簡単に証明書をデバッグしてリリースすることができます。さらに気にしないでください –

関連する問題