我的谷歌地图应用程序问题出现了问题 这是我的清单代码..
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.GPS"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-sdk android:minSdkVersion="8" />
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
<activity android:name=".GPS_Testing"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps"></uses-library>
</application>
</manifest>
这是我的main.xml文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.google.android.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0trTDjnICco0ZzgjmvY3zTe7PNXzAsoG9iRWtPw"
/>
</LinearLayout>
这是我的主要计划
package com.GPS;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.Toast;
public class GPS_Testing extends MapActivity {
private MapView mapView;
private MapController mapController;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
/*Create MapView Target*/
mapView=(MapView)findViewById(R.id.mapview);
LocationManager mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
LocationListener mlocListener = new MyLocationListener();
mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, mlocListener);
mapView.setBuiltInZoomControls(true);
mapController = mapView.getController();
mapController.setZoom(16);
}
/* Class My Location Listener */
public class MyLocationListener implements LocationListener
{
@Override
public void onLocationChanged(Location loc)
{
loc.getLatitude();
loc.getLongitude();
String Text = "My current location is:" +
"Latitud =" + loc.getLatitude() +
"Longitud =" + loc.getLongitude();
Toast.makeText( getApplicationContext(),
Text,
Toast.LENGTH_LONG).show();
}
@Override
public void onProviderDisabled(String provider)
{
Toast.makeText( getApplicationContext(),
"Gps Disabled",
Toast.LENGTH_SHORT ).show();
}
@Override
public void onProviderEnabled(String provider)
{
Toast.makeText( getApplicationContext(),
"Gps Enabled",
Toast.LENGTH_SHORT).show();
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
}
@Override
protected boolean isRouteDisplayed()
{
return false;
}
}
Logcat错误:
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): FATAL EXCEPTION: main
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): java.lang.NoClassDefFoundError: android.net.NetworkConnectivityListener
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at com.google.android.maps.MapActivity.onCreate(MapActivity.java:199)
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at com.GPS.GPS_Testing.onCreate(GPS_Testing.java:19)
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at android.os.Handler.dispatchMessage(Handler.java:99)
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at android.os.Looper.loop(Looper.java:123)
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at java.lang.reflect.Method.invokeNative(Native Method)
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at java.lang.reflect.Method.invoke(Method.java:521)
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-28 15:04:08.333: ERROR/AndroidRuntime(12075): at dalvik.system.NativeStart.main(Native Method)
07-28 15:04:08.341: ERROR/liblog(1207): failed to call dumpstate
答案 0 :(得分:0)
您是否可以右键单击Eclipse中的Project和属性,然后选择Android并告诉我什么是项目构建目标。