Android Development Service not registered com google android gms common internal bf

0 votes

I m using the "com.google.android.gms.maps.MapFragment" to display a map in a embedded fragment. When I try to close the activity , the application crashes with this:

E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.IllegalArgumentException: Service not registered: com.google.android.gms.common.internal.bf@5368ecf4
            at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:921)
            at android.app.ContextImpl.unbindService(ContextImpl.java:1459)
            at android.content.ContextWrapper.unbindService(ContextWrapper.java:484)
            at com.google.android.gms.common.stats.c.a(SourceFile:145)
            at com.google.android.gms.common.internal.bc.handleMessage(SourceFile:208)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5041)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
            at dalvik.system.NativeStart.main(Native Method)

I even tried to start the map fragment with a try/catch:

try {
            GoogleMapOptions options = new GoogleMapOptions();
            options.zoomControlsEnabled(true);

            mMapFragment = MapFragment.newInstance(options);
            FragmentTransaction fragmentTransaction =
                    getFragmentManager().beginTransaction();
            fragmentTransaction.add(R.id.map, mMapFragment);
            fragmentTransaction.commit();

            mMapFragment.getMapAsync(this);
        } catch (IllegalArgumentException e) {
            Log.e(application.DEBUG_STRING, "error: ", e);
        }

and

public void onMapReady(GoogleMap googleMap) {

        try {
            if (longitude > 0 && latitude > 0) {
                markers = new ArrayList<MarkerOptions>();

                MarkerOptions parkingPosition = new MarkerOptions()
                        .position(new LatLng(latitude, longitude))
                        .title(getString(R.string.positionOfCar));

                googleMap.addMarker(parkingPosition);
                markers.add(parkingPosition);

                LatLngBounds.Builder builder = new LatLngBounds.Builder();
                for (MarkerOptions marker : markers) {
                    builder.include(marker.getPosition());
                }
                LatLngBounds bounds = builder.build();

                int padding = 10; // offset from edges of the map in pixels
                CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);


//            googleMap.moveCamera(cu);
//            googleMap.animateCamera(cu);
                googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(bounds.getCenter(), 10));
                googleMap.moveCamera(CameraUpdateFactory.zoomTo(17));

                Log.d(application.DEBUG_STRING, "zoom " + googleMap.getCameraPosition().zoom);

                if (googleMap.getCameraPosition().zoom >= 18) {
                    googleMap.animateCamera(CameraUpdateFactory.zoomTo(17));
                }
            }
        } catch (IllegalArgumentException e) {
            Log.e(application.DEBUG_STRING, "error: ", e);
        }
    }

any suggestion?

Jun 6 in Others by polo
• 1,500 points
14 views

1 answer to this question.

0 votes
you may want to try GoogleMapOptions options = new GoogleMapOptions(); options .useViewLifecycleInFragment(true) method
answered Jun 6 by nisha
• 2,160 points

Related Questions In Others

0 votes
0 answers

error: package com.android.annotations does not exist

This is my class: import com.android.annotations.NonNullByDefault; @NonNullByDefault public final class ...READ MORE

May 13 in Others by Kichu
• 19,040 points
46 views
0 votes
1 answer
0 votes
1 answer

Running docker on Android

According to the documentation, the Android kernel is ...READ MORE

answered Aug 1, 2018 in Docker by Kalgi
• 52,350 points
2,952 views
0 votes
1 answer

Task Canceled Exception while invoking AWS Lambda

I'm guessing either the TaskCanceledException instance is ...READ MORE

answered Sep 19, 2018 in AWS by Priyaj
• 58,080 points
1,508 views
0 votes
1 answer

ANR in com.google.android.googlequicksearchbox:search

There were two clues of where the ...READ MORE

answered Jun 9 in Others by nisha
• 2,160 points
64 views
0 votes
1 answer

How to get current location in google map android

package com.example.sandeep.googlemapsample; import android.content.pm.PackageManager; import android.location.Location; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.ActivityCompat; import ...READ MORE

answered Jun 1 in Others by nisha
• 2,160 points
17 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP