-1

I am implementing an app in which i have to use google map and code is as follows:

<com.google.android.maps.MapView
     android:id="@+id/mapview1"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:apiKey="0ACHOtlugQlOpv7OWSc2GYfNmJfYY1ltGNlzgEQ"
     android:clickable="true"
     android:enabled="true" >
 </com.google.android.maps.MapView>

and i got this exception:


11-23 12:50:52.796: I/System.out(24625): android.view.InflateException: Binary XML file line #68: Error inflating class com.google.android.maps.Mapview
11-23 12:28:44.445: E/AndroidRuntime(24124):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
11-23 12:28:44.445: E/AndroidRuntime(24124):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
11-23 12:28:44.445: E/AndroidRuntime(24124):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-23 12:28:44.445: E/AndroidRuntime(24124):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
11-23 12:28:44.445: E/AndroidRuntime(24124):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-23 12:28:44.445: E/AndroidRuntime(24124):    at android.os.Looper.loop(Looper.java:123)
11-23 12:28:44.445: E/AndroidRuntime(24124):    at android.app.ActivityThread.main(ActivityThread.java:3687)
11-23 12:28:44.445: E/AndroidRuntime(24124):    at java.lang.reflect.Method.invokeNative(Native Method)
11-23 12:28:44.445: E/AndroidRuntime(24124):    at java.lang.reflect.Method.invoke(Method.java:507)
11-23 12:28:44.445: E/AndroidRuntime(24124):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
11-23 12:28:44.445: E/AndroidRuntime(24124):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
11-23 12:28:44.445: E/AndroidRuntime(24124):    at dalvik.system.NativeStart.main(Native Method)
11-23 12:28:44.445: E/AndroidRuntime(24124): Caused by: java.lang.NullPointerException
11-23 12:28:44.445: E/AndroidRuntime(24124):    at com.trigma.mcs.Outsubmap.onCreate(Outsubmap.java:23)
11-23 12:28:44.445: E/AndroidRuntime(24124):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-23 12:28:44.445: E/AndroidRuntime(24124):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
animuson
  • 53,861
  • 28
  • 137
  • 147
  • 1
    Have You Google APIs attached? I would appreciate it if You could share more output from LogCat. – sandrstar Nov 23 '11 at 06:09
  • sandrstar, i have edited all the values of logcat and Actully i am implementing two map views in same app and one is working fine but other gives exception –  Nov 23 '11 at 07:02

2 Answers2

3

Did you specify the shared library in manifest file?

<uses-library android:name="com.google.android.maps" />

More info

Chirag
  • 56,621
  • 29
  • 151
  • 198
abhinav
  • 3,199
  • 2
  • 21
  • 25
  • 1
    i have used this lib but still the exception is same.. Actully i am implementing two map views in same app and one is working fine but other gives exception –  Nov 23 '11 at 07:04
  • If you want to use multiple instances of mapview. See [this related question](http://stackoverflow.com/questions/5080199/starting-multiple-map-activities) – abhinav Nov 23 '11 at 07:09
2

This was due to mapActivity. Actully i forgot to extend mapactivity and by extending that my code worked.

Prashant Lakhlani
  • 5,758
  • 5
  • 25
  • 39