2

I am working on an Android project in which I have some map functionality. It works on my mobile, but when I try one of my colleagues mobile which is a NExus and runs android 6.0.1, he cant see maps or any markers. I also connected it to USB debugging, and the only warning/error I get on both devices is by GoogleSignature, complaining its not verified.

Error log :

nchify V/GoogleSignatureVerifier: myproject signature not valid.  Found: 
                                                                                         RANDOM_DATA
05-25 11:51:21.552 29264-30085/myproject D/GoogleCertificatesImpl: Fetched 300 Google certificates
05-25 11:51:21.572 29264-30085/myproject V/GoogleSignatureVerifier: myproject signature not valid.  Found: RANDOM_DATA

05-25 11:51:22.549 29264-30047/myproject D/Volley: [2616] hj.a: HTTP response for request=<[ ] https://clients4.google.com/glm/mmap/api 0x99e6744e NORMAL 1> [lifetime=3750], [size=83], [rc=200], [retryCount=0]
05-25 11:51:22.551 29264-29264/myprojectg D/Volley: [1] gu.b: 3782 ms: [ ] https://clients4.google.com/glm/mmap/api 0x99e6744e NORMAL 1
05-25 11:51:22.549 29264-30047/myproject D/Volley: [2616] hj.a: HTTP response for request=<[ ] https://clients4.google.com/glm/mmap/api 0x99e6744e NORMAL 1> [lifetime=3750], [size=83], [rc=200], [retryCount=0]
05-25 11:51:22.551 29264-29264/myproject D/Volley: [1] gu.b: 3782 ms: [ ] https://clients4.google.com/glm/mmap/api 0x99e6744e NORMAL 1
05-25 11:51:28.796 29264-30048/myproject D/Volley: [2617] hj.a: HTTP response for request=<[ ] https://csi.gstatic.com/csi?s=maps_android_api&v=3&action=map_start_up&it=map_load.4554,on_create.1,on_resume.6,init.317&irt=4555,319,2420,318 0x4d844933 NORMAL 3> [lifetime=5644], [size=0], [rc=204], [retryCount=1]
05-25 11:51:28.805 29264-29264/myproject D/Volley: [1] gu.b: 5656 ms: [ ] https://csi.gstatic.com/csi?s=maps_android_api&v=3&action=map_start_up&it=map_load.4554,on_create.1,on_resume.6,init.317&irt=4555,319,2420,318 0x4d844933 NORMAL 3
05-25 11:51:32.124 29264-29285/myproject W/art: Suspending all threads took: 11.324ms

As there is no known error, I have to add most of the class below.

Code :

public class MapsActivity extends DrawerLoader {

 GoogleMap googleMap;
    SharedPreferences sharedPreferences;
    int locationCount = 0;

    private RestaurantServiceImpl restaurantService = new RestaurantServiceImpl();

    List<RestRestaurant> restRestaurantList = new ArrayList<>();

    GPSTracker gps;

    double longitude, latitude;
 String zoom;

    boolean firstClick = false;
    int restaurantId = 0;
 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mapsact);
        set();
  SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
        googleMap = fm.getMap();

        // Getting GoogleMap object from the fragment

        googleMap.getUiSettings().setMapToolbarEnabled(true);

        // Enabling MyLocation Layer of Google Map
        googleMap.setMyLocationEnabled(true);


        // Opening the sharedPreferences object
        sharedPreferences = getSharedPreferences("location", 0);

        // Getting number of locations already stored
        locationCount = sharedPreferences.getInt("locationCount", 0);


        // Getting stored zoom level if exists else return 0
         zoom = sharedPreferences.getString("zoom", "12");

        gps = new GPSTracker(MapsActivity.this);

        if (gps.canGetLocation()) {
            longitude = gps.getLongitude();
            latitude = gps.getLatitude();

            Double[] gpsArray = new Double[]{longitude,latitude};

            new getListOfRestaurantsForUser(this).execute(gpsArray);

            restRestaurantList = this.restaurantService.getRestaurantsByLocation(longitude, latitude);
        } else {
            gps.showSettingsAlert();
        }

        googleMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
            @Override
            public boolean onMarkerClick(Marker marker) {
                int restoId = Integer.valueOf(marker.getSnippet());

                if((!firstClick) && (restaurantId != restoId)){
                    firstClick = true;
                    restaurantId = restoId;
                    marker.showInfoWindow();
                    return false;
                }else {
                    firstClick = false;
                    restaurantId = restoId;
                    Intent intent = new Intent(MapsActivity.this, MenuCardList.class);
                    intent.putExtra("restaurantid", restoId);
                    startActivity(intent);
                    finish();
                    return true;
                }
            }
        });
    }

    private void drawMarker(LatLng point, String restaurantName, int restaurantId){
        // Creating an instance of MarkerOptions
        MarkerOptions markerOptions = new MarkerOptions();

        // Setting latitude and longitude for the marker
        markerOptions.position(point);
        markerOptions.snippet(String.valueOf(restaurantId));
        markerOptions.title(restaurantName);

        // Adding marker on the Google Map
       Marker marker = googleMap.addMarker(markerOptions);

        marker.showInfoWindow();
        googleMap.getUiSettings().setMapToolbarEnabled(true);

    }
}

build.gradle :

apply plugin: 'com.android.application'

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:support-v4:22.2.1'
    compile 'com.fasterxml.jackson.core:jackson-core:2.6.0'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.6.0'
    compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
    compile 'org.springframework.android:spring-android-core:1.0.1.RELEASE'
    compile ('org.springframework.android:spring-android-auth:1.0.1.RELEASE'){
        exclude group :'org.springframework', module: 'commons-logging'
        exclude group :'org.springframework', module: 'spring-core'
        exclude group :'org.springframework', module: 'spring-web'
    }
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.6.0'
    compile 'com.google.android.gms:play-services:7.5.0'
    compile 'commons-codec:commons-codec:1.9'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:design:22.2.1'

}

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    defaultConfig {
        applicationId "myproject"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    productFlavors {
    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
}

I hope this much information is sufficient, if anything else is required, please let me know.

We are Borg
  • 5,117
  • 17
  • 102
  • 225
  • Generate android API with keystore signature – Aditay Kaushal May 25 '16 at 10:47
  • @AditayKaushal : What exactly do you mean by that? – We are Borg May 25 '16 at 10:59
  • in my same case i was using debug key, then map was showing in some of mobile, then after when i create API with keystore signature then worked well – Aditay Kaushal May 25 '16 at 11:19
  • @AditayKaushal : Which key are you talking about, google key?. I am using a server key from Google. My keystore is newly created and is set for release, not for debug. Is that what you meant? – We are Borg May 25 '16 at 11:33
  • for map we select android key not server key from google console . please confirm this which key are you using – Aditay Kaushal May 25 '16 at 11:35
  • @AditayKaushal : Sorry, my mad, you are correct, I am using the Android key already. I am using server key for Places API where I want data in JSON, caused some confusion. – We are Borg May 25 '16 at 11:37
  • Error log : you printed here not responsible for this ,may be – Aditay Kaushal May 25 '16 at 11:37
  • @wo oke,then please create android key once as a keystore signature,may be work. – Aditay Kaushal May 25 '16 at 11:39
  • Have you checked this [SO question](http://stackoverflow.com/questions/37296031/why-do-i-get-signature-not-valid-ongoogle-maps-android-api)? Try checking if you have the correct hash SHA-1 key or a [bug](http://stackoverflow.com/a/37411163/5995040) is affecting your app. I hope this helps – Mr.Rebot May 26 '16 at 08:33
  • @Mr.Rebot : Yes, one one other thread it was also mentioned that if the signing keystore is more than 1 year old then this problem happens. FOr the very reason I created a new keystore and signed the app with that. Changed credentials in developer console. What I don't understand is why it doesn't effect other mobiles but Nexus? – We are Borg May 26 '16 at 08:35
  • I think it is not only Nexus that is being affected by this bug. According to [Ian Barber's answer](http://stackoverflow.com/a/37379789/5995040) it is just logging and shouldn't affect your app. – Mr.Rebot May 26 '16 at 08:52
  • @Mr.Rebot : Any idea what is effecting? I can't understand where to start my search for this problem. – We are Borg May 26 '16 at 08:53

0 Answers0