2016-07-21 7 views
0

Mein Problem ist, wenn ich die App läuft zeigt es Google-Symbol in der linken Ecke in der App und wenig graue Farbe in Aktivität, aber es zeigt Google Map.Kann niemand dieses Problem lösen Unaufrichtigkeit Ich verweise viele Websites?Probleme bei der Anzeige von Kartendaten mit Kartenintegration

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { 
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); 
} 
@Override 
public void onMapReady(GoogleMap googleMap) { 
    mMap = googleMap; 
    LatLng sydney = new LatLng(-34, 151); 
    mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney")); 
    mMap.animateCamera(CameraUpdateFactory.newLatLng(sydney)); 
} 
} 

Manifest-Datei

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.example.anilkumar.mapsactivity"> 
<permission android:name="com.example.anilkumar.permission.MAPS_RECEIVE"/> 
<uses-permission android:name="android.permission.INTERNET"/> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
    <uses-permission  android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 
<uses-permission android:name="com.example.anilkumar.permission.MAPS_RECEIVE"/> 
<!-- 
    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_COARSE_LOCATION"/> 

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme" 
    android:name="android.support.multidex.MultiDexApplication"> 
    <!-- 
     The API key for Google Maps-based APIs is defined as a string resource. 
     (See the file "res/values/google_maps_api.xml"). 
     Note that the API key is linked to the encryption key used to sign the APK. 
     You need a different API key for each encryption key, including the release key that is used to 
     sign the APK for publishing. 
     You can define the keys for the debug and release targets in src/debug/ and src/release/. 
    --> 
    <meta-data 
     android:name="com.google.android.maps.v2.API_KEY" 
     android:value="@string/google_maps_key" /> 

    <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> 
</application> 

Antwort

0
  1. Vergewissern Sie sich, Standort Berechtigung aktiviert, wenn Sie auf Eibisch Geräte testen
  2. die richtige Google Maps API Schlüssel und Einstellung aktiviert google maps api in Ihrer Konsole
  3. Immer noch Fehler folgen ow diese Tutorials this, this, this, this, this Hoffe, dass es Ihnen hilft