Recently, I re-check my old project using Google Maps Android API v2, it work without error before. But LogCat show error:
...
E/AndroidRuntime(20411): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.MapFragment: make sure class name exists, is public, and has an empty constructor that is public
...
E/AndroidRuntime(20411): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment
...
Then I re-visit the layout xml with MapFragment, error message show Unexpected namespace prefix "xmlns" found for tag fragment on the statement xmlns:map="http://schemas.android.com/apk/res-auto".
To solve it, correct Java Build Path by right clicking on your project -> Java Build Path, select Order and Export tab, check both Android 4.2.2 and Android Private Libraries, and click OK.
And then clean and build the project.
Similar to the case: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo
Thanks for the awesome walkthrough!
ReplyDeleteDo you know how to fix this in Android Studio?
Sorry, I never tried Android Studio actually.
ReplyDeleteHie guys,
ReplyDeleteI appologize but the solution you mentioned doesn't work for me.
I use a windows 7 plateform and Eclipse juno. I'm playing around trying to get google examples working.
The project I use is the one I import from maps comming from the repository extras located in C:\Users\yourname\AppData\Local\Android\android-sdk\extras\google\google_play_services\samples\maps\.
So for me the solution you proposed doesn't if I re check the project after doing a clean.
Indeed I think that when you do a clean on a project it flushes the RLint errors. And then you'll be able to compile.
But after doing a clean on your project,if you right click on it, and you click the Android Tools and Run Lint: check for common errors option, then you'll see errors coming back.
Do you agree?
Oliver.
Sorry for my broken english...I'm french ;-)