Unable to instantiate android.gms.maps.SupportMapFragment
Judging by you error:
Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment:
make sure class name exists, is public, and has an empty constructor that is public
and the fact the SupportManFragment
class is part of the google-play-services
library, you problem is surtenly in the way you reference this library or the library it self.
I would suggest you to re-download it using the SDK-Manager and move it to a location where it path would be shorter and then try to reference it again using the answer you have in this question:
Error java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment in Google Map V2
Unable to instantiate fragment com.google.android.gms.maps.MapFragment in Activity
I spend few days.but can't resolve this issue in Eclipse tool.Then I tried with Android studio.
Map is working fine.Issue has been resolved only in studio.In eclipse many times google map library issue happened to me.But when I moved to studio, my code is working fine.
Error occurred due to changes in new OS changed with eclipse tool and sdk.It might be google map library issue.
Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment after migration of androidX
You have to use a SupportMapFragment
migrated from Android Support Libraries to AndroidX Libraries.
In you case use this version or later.
com.google.android.gms:play-services-maps:17.0.0
If you check the doc it extends androidx.fragment.app.Fragment
.
Could Not Find Class com.google.android.gms.maps.SupportMapFragment
I do not see you mention adding the Android support library
android-support-v4.jar
. You need to make sure Eclipse is properly including it forcom.google.android.gms.maps.SupportMapFragment
to work:Another potential issue is mismatch of play services library in your app and the play services verion on your nexus 5 device. If you downloaded the latest library from SDK manager, it may be higher version than the one on your device. I am guessing your play services version on device is 5.0.89, you can check on device
Settings -> Apps -> Downloaded -> Google Play Services
. Try using older version of the library if that's the case.
Error using Map in app - com.google.android.gms.maps.MapFragment cannot be cast to android.support.v4.app.Fragment
Have you also changed the map in your XML layout?
Should look like this:
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp" />
Related Topics
What Is an Android Pendingintent
Refreshing Oauth Token Using Retrofit Without Modifying All Calls
How to Create a Listview with Rounded Corners in Android
How to Programmatically Open the Permission Screen for a Specific App on Android 6.0 (Marshmallow)
Android Paint: .Measuretext() VS .Gettextbounds()
How to Set Different Label for Launcher Rather Than Activity Title
What to Use Instead of "Addpreferencesfromresource" in a Preferenceactivity
How to Achieve Ripple Animation Using Support Library
How to Implement Drawerarrowtoggle from Android Appcompat V7 21 Library
How to Make a Dotted/Dashed Line in Android
How to Serialize an Object and Save It to a File in Android
This Version of the Application Is Not Configured for Billing Through Google Play
How to Debug JavaScript on Android
How to Use Addr2Line in Android
Android Preventing Double Click on a Button
How to Hide a Menu Item in the Actionbar
Formula Px to Dp, Dp to Px Android
Android Linearlayout:Add Border with Shadow Around a Linearlayout