0

My app contains a mapFragment, which used to work. However, after some changes in the code, it no longer works (it only shows the google logo at the bottom).Unfortunately, I have overwritten the working code.

Here is the MapActivity:

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

private GoogleMap mMap;
String tag="Babis map";

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.i(tag,"onCreate start");
    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);
    Log.i(tag,"onCreate end");
}

@Override
public void onMapReady(GoogleMap googleMap) {
    Log.i(tag,"mapready start");
    mMap = googleMap;
    // Add a marker in Sydney and move the camera
    LatLng cent=new LatLng(35.36,24.48);
    //mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
    //mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
    mMap.addMarker(new MarkerOptions()
            .position(new LatLng(35.3617284,24.4863311))
            .anchor(0.5f, 0.5f)
            .title("Bob")
            .snippet("potato")
            .icon(BitmapDescriptorFactory
                    .defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));
    mMap.moveCamera(CameraUpdateFactory.newLatLng(cent));
    mMap.moveCamera(CameraUpdateFactory.zoomTo(13) );
    Log.i(tag,"onCreate end");
}



}

Here is the Manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="charalampos.walker">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-feature android:name="android.hardware.location.gps" />


<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity
        android:name=".MainActivity"
        android:configChanges="orientation|screenSize"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <!--
         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.geo.API_KEY"
        android:value="@string/google_maps_key" />

    <activity
        android:name=".MapsActivity"
        android:label="@string/title_activity_maps" />

    <service
        android:name=".YourService"
        android:enabled="true"
        android:exported="true" />

    <receiver
        android:name=".Alarm"
        android:enabled="true"
        android:exported="true">
        <intent-filter>
            <action android:name="habos.START_ALARM"></action>
        </intent-filter>
    </receiver>
</application>

</manifest>

I recently had to reinstall AS, and had to clean and rebuild the project. could this have affected the app, the Map key or something?

The Logcat output is this (sorry for the bad format):

12-21 22:38:50.087 23354-23354/charalampos.walker I/Babis map: onCreate start 12-21 22:38:50.143 23354-23354/charalampos.walker I/zzai: Making Creator dynamically 12-21 22:38:50.247 23354-23354/charalampos.walker I/System.out: [/system/bin/getprop, debug.mapview.logs] 12-21 22:38:50.247 23354-23354/charalampos.walker I/System.out: null 12-21 22:38:50.247 23354-23354/charalampos.walker I/System.out: null 12-21 22:38:50.248 23354-23354/charalampos.walker I/System.out: Calling by::className:com.google.maps.api.android.lib6.common.o MethodName:a 12-21 22:38:50.284 23354-23354/charalampos.walker I/Google Maps Android API: Google Play services client version: 10298000 12-21 22:38:50.294 23354-23354/charalampos.walker I/Google Maps Android API: Google Play services package version: 11951446 12-21 22:38:50.296 23354-23354/charalampos.walker I/System.out: [/system/bin/getprop, debug.mapview.renderer] 12-21 22:38:50.296 23354-23354/charalampos.walker I/System.out: null 12-21 22:38:50.296 23354-23354/charalampos.walker I/System.out: null 12-21 22:38:50.297 23354-23354/charalampos.walker I/System.out: Calling by::className:com.google.maps.api.android.lib6.common.o MethodName:a 12-21 22:38:50.332 23354-23354/charalampos.walker I/System.out: [/system/bin/getprop, debug.mapview.streetview] 12-21 22:38:50.332 23354-23354/charalampos.walker I/System.out: null 12-21 22:38:50.332 23354-23354/charalampos.walker I/System.out: null 12-21 22:38:50.333 23354-23354/charalampos.walker I/System.out: Calling by::className:com.google.maps.api.android.lib6.common.o MethodName:a 12-21 22:38:50.409 23354-23354/charalampos.walker I/System.out: [/system/bin/getprop, debug.mapview.gmmserver] 12-21 22:38:50.410 23354-23354/charalampos.walker I/System.out: null 12-21 22:38:50.410 23354-23354/charalampos.walker I/System.out: null 12-21 22:38:50.411 23354-23354/charalampos.walker I/System.out: Calling by::className:com.google.maps.api.android.lib6.common.o MethodName:a 12-21 22:38:50.590 23354-23354/charalampos.walker I/System.out: [/system/bin/getprop, debug.mapview.renderer.label] 12-21 22:38:50.590 23354-23354/charalampos.walker I/System.out: null 12-21 22:38:50.590 23354-23354/charalampos.walker I/System.out: null 12-21 22:38:50.590 23354-23354/charalampos.walker I/System.out: Calling by::className:com.google.maps.api.android.lib6.common.o MethodName:a 12-21 22:38:50.827 3163-3172/? I/art: Background partial concurrent mark sweep GC freed 90218(6MB) AllocSpace objects, 37(636KB) LOS objects, 32% free, 32MB/48MB, paused 3.535ms total 252.052ms 12-21 22:38:50.885 23354-23354/charalampos.walker I/Babis map: onCreate end 12-21 22:38:50.893 23354-23354/charalampos.walker I/Choreographer: Skipped 51 frames! The application may be doing too much work on its main thread. 12-21 22:38:50.901 2474-2474/? E/HAL: load: id=gralloc != hmi->id=gralloc 12-21 22:38:50.922 2474-2527/? I/[Gralloc]: alloc w[720] h[1280] format[1] usage[3842] 12-21 22:38:50.924 2474-2527/? I/[Gralloc]: alloc succ handle[0x55a2081780] stride[720] 12-21 22:38:50.925 2474-2949/? I/[Gralloc]: alloc w[720] h[1280] format[1] usage[3842] 12-21 22:38:50.928 2474-2949/? I/[Gralloc]: alloc succ handle[0x55a207ba70] stride[720] 12-21 22:38:50.928 2474-2949/? I/[Gralloc]: alloc w[720] h[1280] format[1] usage[3842] 12-21 22:38:50.931 2474-2949/? I/[Gralloc]: alloc succ handle[0x55a207bc40] stride[720] 12-21 22:38:50.931 2474-2949/? I/[Gralloc]: alloc w[720] h[1280] format[1] usage[3842] 12-21 22:38:50.934 2474-2949/? I/[Gralloc]: alloc succ handle[0x55a20425f0] stride[720] 12-21 22:38:50.946 4616-4627/? I/System.out: [/system/bin/getprop, debug.mapview.gmmserver] 12-21 22:38:50.946 4616-4627/? I/System.out: null 12-21 22:38:50.946 4616-4627/? I/System.out: null 12-21 22:38:50.946 4616-4627/? I/System.out: Calling by::className:azpr MethodName:a 12-21 22:38:50.974 23354-23354/charalampos.walker I/Babis map: mapready start 12-21 22:38:51.032 23354-23354/charalampos.walker I/Babis map: onCreate end

I recently had to reinstall AS, and had to clean and rebuild the project. could this have affected the app, the Map key or something?

Charor
  • 94
  • 1
  • 11
  • 1
    You probably have a different debug key now. You'll have to update your API key with the SHA1 fingerprint of your new debug key: https://stackoverflow.com/questions/15727912/sha-1-fingerprint-of-keystore-certificate – Daniel Nugent Dec 21 '17 at 21:03
  • thank you, I honestly didn't think that was the issue, I just mentioned it just to be sure. Sorry for wasting your time – Charor Dec 21 '17 at 22:54

0 Answers0