0

I am new to Google Maps V2 certification map implementation ,

but i integrated according to the steps in https://developers.google.com/maps/documentation/android/start but i get a crash .

It displays a white screen for a moment and crashes , with the logcat

06-01 04:07:03.459: E/AndroidRuntime(1199): FATAL EXCEPTION: main
06-01 04:07:03.459: E/AndroidRuntime(1199): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sample.map_test/com.sample.map_test.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.os.Handler.dispatchMessage(Handler.java:99)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.os.Looper.loop(Looper.java:130)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.app.ActivityThread.main(ActivityThread.java:3687)
06-01 04:07:03.459: E/AndroidRuntime(1199): at java.lang.reflect.Method.invokeNative(Native Method)
06-01 04:07:03.459: E/AndroidRuntime(1199): at java.lang.reflect.Method.invoke(Method.java:507)
06-01 04:07:03.459: E/AndroidRuntime(1199): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
06-01 04:07:03.459: E/AndroidRuntime(1199): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
06-01 04:07:03.459: E/AndroidRuntime(1199): at dalvik.system.NativeStart.main(Native Method)
06-01 04:07:03.459: E/AndroidRuntime(1199): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
06-01 04:07:03.459: E/AndroidRuntime(1199): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:209)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.app.Activity.setContentView(Activity.java:1657)
06-01 04:07:03.459: E/AndroidRuntime(1199): at com.sample.map_test.MainActivity.onCreate(MainActivity.java:12)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
06-01 04:07:03.459: E/AndroidRuntime(1199): ... 11 more
06-01 04:07:03.459: E/AndroidRuntime(1199): Caused by: android.support.v4.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
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.support.v4.app.Fragment.instantiate(Fragment.java:401)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.support.v4.app.Fragment.instantiate(Fragment.java:369)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
06-01 04:07:03.459: E/AndroidRuntime(1199): ... 19 more
06-01 04:07:03.459: E/AndroidRuntime(1199): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment in loader dalvik.system.PathClassLoader[/data/app/com.sample.map_test-1.apk]
06-01 04:07:03.459: E/AndroidRuntime(1199): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
06-01 04:07:03.459: E/AndroidRuntime(1199): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
06-01 04:07:03.459: E/AndroidRuntime(1199): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
06-01 04:07:03.459: E/AndroidRuntime(1199): at android.support.v4.app.Fragment.instantiate(Fragment.java:391)
06-01 04:07:03.459: E/AndroidRuntime(1199): ... 22 more

when i checked for the included library file google-play-services_lib , it displayed with the red colored cross symbol . I removed and added it again , while adding it shows with green color tick mark and once i save and close it turns to red cross .

Why do i cant add this library project ? Please suggest me where i am going wrong .

For your information , Just for testing i tried the following , I have also tried coping the google-play-services_lib projects library jar files and pasted in my project libs folder , but still i get the same crash .

Any related answers are welcomed . Thanks in Advance .

Community
  • 1
  • 1
VIGNESH
  • 2,023
  • 8
  • 31
  • 46
  • did you solve this problem?i'm also having same problem but didn't get any solution yet.- http://stackoverflow.com/questions/18386750/map-activity-in-android – yuva ツ Aug 22 '13 at 18:29

1 Answers1

0

You should not copy the jar into libs folder. You should refer the library project in your android project.

import library project into workspace into eclipse. THe library project can be found at

   <android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib library project .

Click File > Import, select Android > Existing Android Code into Workspace, and browse the workspace import the library project. You can check if it is library project. Right click on the library project. Goto properties. Click Android on the left panel. You will see Is Library checked.

Right click on your project. Goto properties. Choose android. Click add. Browse and aadd the library project. Clean and build

enter image description here

Raghunandan
  • 132,755
  • 26
  • 225
  • 256
  • Yeah i have tried that also but while adding i get green color tick mark but once i save and close it turns to red cross . It means not adding properly . – VIGNESH Jun 01 '13 at 04:49
  • @VIGNESH if you have updated adt to rev 22 right click on your project. goto java build path. choose order export tab. make sure android private libraries are checked fro both android project and library project. – Raghunandan Jun 01 '13 at 04:52
  • I have checked android private libraries for both the projects and for your information just for testing i copied the jars into my libs folder . i have removed immediately after testing . – VIGNESH Jun 01 '13 at 04:58
  • @VIGNESH it s library project. So you should refer it in your android project. Not copy the jar into your project libs folder. – Raghunandan Jun 01 '13 at 04:59
  • Bro. just for testing i did . . . . . now removed . – VIGNESH Jun 01 '13 at 05:01
  • @VIGNESH for whatever it doesn't make any sense coz what you did was wrong. you will get exceptions. – Raghunandan Jun 01 '13 at 05:02
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/31017/discussion-between-vignesh-and-raghunandan) – VIGNESH Jun 01 '13 at 05:02