1

Before I begin I have tried every solution offered under similar questions posted on stackoverflow as well as other forums to no avail:

I have the following code to render maps...It worked for a few days then outright stopped working. I have changed the API keys but also nothing.

public class The_Map_Fragment extends SherlockFragment  {
..........
..........
if (googleMap == null) {
        googleMap = ((SupportMapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap();

        googleMap.setMyLocationEnabled(true); 
        googleMap.getUiSettings().setZoomControlsEnabled(true);
        googleMap.getUiSettings().setZoomGesturesEnabled(true);
        googleMap.getUiSettings().setMyLocationButtonEnabled(true);
        CameraPosition cameraPosition = new CameraPosition.Builder().target(new LatLng(-1.281509, 36.816974)).zoom(13).build();
        googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); 
        if (googleMap == null) {
            Toast.makeText(getActivity(),"Sorry! unable to Instatntiate Google Maps", Toast.LENGTH_SHORT).show();


        }


    }

My xml is as below:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<fragment
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

My Manifest has all refrences and permissions ok

<permission android:name="com.the.app.rr.permission.MAPS_RECEIVE"  
    android:protectionLevel="signature" />
<uses-permission android:name="com.the.app.rr.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" />

<!-- Required to show current location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<uses-feature android:glEsVersion="0x00020000" android:required="true"/>

When I run I get the error Could not find class 'com.google.android.gms.location.internal.ParcelableGeofence', referenced from method gls.a

James Wahome
  • 588
  • 11
  • 31
  • are you using proguard or did you enable it in your project? – Sam Aug 01 '14 at 12:36
  • No am not using proguard – James Wahome Aug 01 '14 at 12:39
  • @Jaymo Me too facing same issue did you got any solution?? – Shailendra Madda Aug 02 '14 at 05:42
  • it is a device generic issue..I tries in my Nexus 7 and the error persisted whereas while it tries in Moto E everything was working smoothly – williamj949 Aug 02 '14 at 11:16
  • So is there a work around to it...am testing on a Galaxy Nexus – James Wahome Aug 04 '14 at 05:52
  • @goonerdroid I doubt its a Device issue...tested it with 4 other devices and the results are similar, It works some time, other time it doesnt – James Wahome Aug 04 '14 at 06:08
  • How was the problem solved? – S.M_Emamian Sep 03 '14 at 11:47
  • Still hasn't been solved...although there are interesting findings on the reason why the error is being showed – James Wahome Sep 04 '14 at 13:26
  • maybe the following link would help: http://stackoverflow.com/questions/14423267/android-google-map-api-version-2/25693129#25693129 – E_X Sep 05 '14 at 20:17
  • @E_X Let me setup a VM with a 32bit environment and see if it works on my end – James Wahome Sep 08 '14 at 07:51
  • @Jaymo in addition to that I ended up using a mapView, as the best answer in this link shows (http://stackoverflow.com/questions/20919048/android-android-view-inflateexception-binary-xml-file-line-8-error-inflatin), the MapView seems to fit better inside the fragment life-cycle. – E_X Sep 08 '14 at 08:31
  • Let me look at the answer. I really hope It will solve the issue for me – James Wahome Sep 08 '14 at 08:34
  • Let me know if it worked for you. – E_X Sep 08 '14 at 11:28
  • @E_X I got a 32 bit machine and did a fresh setup..Imported the code and tried the first solution you offered. That didn't work. So I tried the second solution of using a Mapview still similar results. My test device was a Google Nexus Haven't tired any other phone with the two solutions offered – James Wahome Sep 15 '14 at 14:50
  • @Jaymo ok when you initialize your map, are you requesting the user's current location to be shown in the map? or your just adding the map in xml?! – E_X Sep 16 '14 at 09:39
  • @E_X Just showing the map..I have commented out all location based calls. – James Wahome Sep 16 '14 at 12:29
  • @Jaymo I asked you that question; because the error continued to appear due to requesting to get the LatLang for the user without checking if the Location service, network provider is enabled on the user's phone or not. – E_X Sep 16 '14 at 16:33
  • now here is the xml mapView that I used: , and within the OncreateView method inside MyFragment class: View fragmentView = inflater.inflate(R.layout.the_fragment_layout, container, false); MapView mapView = (MapView) fragmentView.findViewById(R.id.map); mapView.onCreate(savedInstanceState); also you need to call the mapViews onResume(), onDestory(), onLowMemory() within each method of the fragments life cycle :) – E_X Sep 16 '14 at 16:37
  • I opted to use MapView Instead and as pointed it eventually worked. The problem it appears was emanating from using okHTTP as my network layer. After days of research I found this https://github.com/mapbox/mapbox-android-sdk/issues/321 and https://github.com/mapbox/mapbox-android-sdk/issues/322 which outline the pifalls. on resuming to a clean Volley the maps now work as expected – James Wahome Sep 24 '14 at 14:26

1 Answers1

0

For me setting Eclipse's Preferences -> Android -> Build -> Custom keystore fixed the problem. Also uninstall app and clean build.

SpyZip
  • 5,511
  • 4
  • 32
  • 53