Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Maps in Android API v2 shows error
    text
    copied!<p>I am trying to implement google maps. But it always gets error.</p> <p>My Activity</p> <pre><code>package com.alex.googlemaps; import android.os.Build; import android.os.Bundle; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import android.annotation.TargetApi; import android.app.Activity; import android.view.Menu; @TargetApi(Build.VERSION_CODES.HONEYCOMB) public class MainActivity extends Activity { private GoogleMap mMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE); final LatLng CIU = new LatLng(35.21843892856462, 33.41662287712097); Marker ciu = mMap.addMarker(new MarkerOptions() .position(CIU).title("My Office")); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } </code></pre> <p>My XML file</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.MapFragment" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Manifest File</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.alex.googlemaps" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /&gt; &lt;permission android:name="com.example.androidmapsv2.permission.MAPS_RECEIVE" android:protectionLevel="signature" &gt; &lt;/permission&gt; &lt;uses-permission android:name="com.alex.googlemaps.permission.MAPS_RECEIVE" /&gt; &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;uses-feature android:glEsVersion="0x00020000" android:required="true" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="com.alex.googlemaps.MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyD-zPbxq6kH0cjw-Axfey-WZ3cmlXqf2LE" /&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>And the logCat shows as</p> <pre><code>04-05 05:44:02.598: E/Trace(1057): error opening trace file: No such file or directory (2) 04-05 05:44:03.038: W/GooglePlayServicesUtil(1057): Google Play services out of date. Requires 3025100 but found 2012110 04-05 05:44:03.058: W/GooglePlayServicesUtil(1057): Google Play services out of date. Requires 3025100 but found 2012110 04-05 05:44:03.148: W/GooglePlayServicesUtil(1057): Google Play services out of date. Requires 3025100 but found 2012110 04-05 05:44:03.188: W/GooglePlayServicesUtil(1057): Google Play services out of date. Requires 3025100 but found 2012110 04-05 05:44:03.198: W/GooglePlayServicesUtil(1057): Google Play services out of date. Requires 3025100 but found 2012110 04-05 05:44:03.258: W/GooglePlayServicesUtil(1057): Google Play services out of date. Requires 3025100 but found 2012110 04-05 05:44:03.258: D/AndroidRuntime(1057): Shutting down VM 04-05 05:44:03.268: W/dalvikvm(1057): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 04-05 05:44:03.278: E/AndroidRuntime(1057): FATAL EXCEPTION: main 04-05 05:44:03.278: E/AndroidRuntime(1057): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.alex.googlemaps/com.alex.googlemaps.MainActivity}: java.lang.NullPointerException 04-05 05:44:03.278: E/AndroidRuntime(1057): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 04-05 05:44:03.278: E/AndroidRuntime(1057): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 04-05 05:44:03.278: E/AndroidRuntime(1057): at android.app.ActivityThread.access$600(ActivityThread.java:141) 04-05 05:44:03.278: E/AndroidRuntime(1057): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 04-05 05:44:03.278: E/AndroidRuntime(1057): at android.os.Handler.dispatchMessage(Handler.java:99) 04-05 05:44:03.278: E/AndroidRuntime(1057): at android.os.Looper.loop(Looper.java:137) 04-05 05:44:03.278: E/AndroidRuntime(1057): at android.app.ActivityThread.main(ActivityThread.java:5041) 04-05 05:44:03.278: E/AndroidRuntime(1057): at java.lang.reflect.Method.invokeNative(Native Method) 04-05 05:44:03.278: E/AndroidRuntime(1057): at java.lang.reflect.Method.invoke(Method.java:511) 04-05 05:44:03.278: E/AndroidRuntime(1057): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 04-05 05:44:03.278: E/AndroidRuntime(1057): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 04-05 05:44:03.278: E/AndroidRuntime(1057): at dalvik.system.NativeStart.main(Native Method) 04-05 05:44:03.278: E/AndroidRuntime(1057): Caused by: java.lang.NullPointerException 04-05 05:44:03.278: E/AndroidRuntime(1057): at com.alex.googlemaps.MainActivity.onCreate(MainActivity.java:24) 04-05 05:44:03.278: E/AndroidRuntime(1057): at android.app.Activity.performCreate(Activity.java:5104) 04-05 05:44:03.278: E/AndroidRuntime(1057): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 04-05 05:44:03.278: E/AndroidRuntime(1057): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 04-05 05:44:03.278: E/AndroidRuntime(1057): ... 11 more 04-05 05:44:03.378: D/dalvikvm(1057): GC_CONCURRENT freed 257K, 14% free 2545K/2948K, paused 16ms+3ms, total 114ms 04-05 05:44:06.338: I/Process(1057): Sending signal. PID: 1057 SIG: 9 </code></pre> <p>I googled a lot but all results are giving error at last. Anybody please helps me to resolve this issue.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload