2014-02-09 5 views
0

Google지도 애플리케이션을 구축하려고합니다 .... https://developers.google.com/maps/documentation/android/ (hello map)과 동일하게 작업하고 있습니다. 하지만 앱을 실행할 때 충돌이 발생합니다. 나는 그 문제를 일으키는 원인을 알지 못한다. 내 코드 : package com.googlemaps;Android지도 기본 앱이 다운 됨

import java.io.IOException; 

import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.MapFragment; 
import com.google.android.gms.maps.SupportMapFragment; 
import com.google.android.gms.maps.model.LatLng; 
import com.google.android.gms.maps.model.MarkerOptions; 

public class MainActivity extends Activity { 

private GoogleMap maps; 

final static String URL = "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/"; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 
    // Get a handle to the Map Fragment 
    maps = ((MapFragment) getFragmentManager() .findFragmentById(R.id.map)).getMap(); 
    maps.setMapType(GoogleMap.MAP_TYPE_SATELLITE); 
    LatLng as = new LatLng(141.0819,37.092); 
    maps.setMyLocationEnabled(true); 
    maps.moveCamera(CameraUpdateFactory.newLatLngZoom(as, 13)); 
    maps.addMarker(new MarkerOptions().title("PlaceName").snippet("Magnitude").position(as)); 


    } 

는 XML ::

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" > 

<fragment 
     android:id="@+id/map" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:name="com.google.android.gms.maps.MapFragment"/> 

</LinearLayout> 

로그 캣 :

02-09 06:46:04.940: W/GooglePlayServicesUtil(1308): Google Play services out of date. Requires 4132500 but found 4033530 
02-09 06:46:04.960: W/GooglePlayServicesUtil(1308): Google Play services out of date. Requires 4132500 but found 4033530 
02-09 06:46:04.970: W/GooglePlayServicesUtil(1308): Google Play services out of date. Requires 4132500 but found 4033530 
02-09 06:46:05.050: W/GooglePlayServicesUtil(1308): Google Play services out of date. Requires 4132500 but found 4033530 
02-09 06:46:05.120: W/GooglePlayServicesUtil(1308): Google Play services out of date. Requires 4132500 but found 4033530 
02-09 06:46:05.210: W/GooglePlayServicesUtil(1308): Google Play services out of date. Requires 4132500 but found 4033530 
02-09 06:46:05.210: D/AndroidRuntime(1308): Shutting down VM 
02-09 06:46:05.210: W/dalvikvm(1308): threadid=1: thread exiting with uncaught exception (group=0xb4aceba8) 
02-09 06:46:05.240: E/AndroidRuntime(1308): FATAL EXCEPTION: main 
02-09 06:46:05.240: E/AndroidRuntime(1308): Process: com.googlemaps, PID: 1308 
02-09 06:46:05.240: E/AndroidRuntime(1308): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.googlemaps/com.googlemaps.MainActivity}: java.lang.NullPointerException 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at android.app.ActivityThread.access$800(ActivityThread.java:135) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at android.os.Handler.dispatchMessage(Handler.java:102) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at android.os.Looper.loop(Looper.java:136) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at android.app.ActivityThread.main(ActivityThread.java:5017) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at java.lang.reflect.Method.invokeNative(Native Method) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at java.lang.reflect.Method.invoke(Method.java:515) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at dalvik.system.NativeStart.main(Native Method) 
02-09 06:46:05.240: E/AndroidRuntime(1308): Caused by: java.lang.NullPointerException 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at com.googlemaps.MainActivity.onCreate(MainActivity.java:52) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at android.app.Activity.performCreate(Activity.java:5231) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 
02-09 06:46:05.240: E/AndroidRuntime(1308):  ... 11 more 
02-09 06:47:02.900: I/Process(1308): Sending signal. PID: 1308 SIG: 9 

내가 문제가이 라인의 일부 생각은 :

 maps.setMapType(GoogleMap.MAP_TYPE_SATELLITE); 
    LatLng as = new LatLng(141.0819,37.092); 
    maps.setMyLocationEnabled(true); 
    maps.moveCamera(CameraUpdateFactory.newLatLngZoom(as, 13)); 
    maps.addMarker(new MarkerOptions().title("PlaceName").snippet("Magnitude").position(as)); 

응용 프로그램은지도를로드 단지 이 모든 코드가 제거되면 괜찮아 ..하지만 발진 나는 아니.

답변

0

Google 서비스의 최신 버전을 갖고 있습니까? setMapType()이 문제를 일으키고 있습니까? 그것은 oncreate에서 52 행의 널 포인터를 말합니다. 그게 뭐야?

+0

setMapType()은 문제가 아닙니다 .. 앱이 여전히 제거됩니다. –

+0

프로그래밍에 대해 많이 알고 있지 않습니다. >>> 제발 도와주세요 ... 널 포인터 란 무엇입니까? –