我已完成显示谷歌地图所需的所有设置。
一切正常。当我运行应用程序时,Map不会显示。
以下是我的代码,
package com.example.findproperty;
public class MainActivity extends FragmentActivity implements LocationListener {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final GoogleMap mMap = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
mMap.setMyLocationEnabled(true);
}
@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;
}
}
logcat的,
04-23 06:57:23.189: W/ActivityThread(3685): Application com.example.findproperty is waiting for the debugger on port 8100...
04-23 06:57:23.289: I/System.out(3685): Sending WAIT chunk
04-23 06:57:23.309: I/dalvikvm(3685): Debugger is active
04-23 06:57:23.339: I/System.out(3685): Debugger has connected
04-23 06:57:23.360: I/System.out(3685): waiting for debugger to settle...
04-23 06:57:23.558: I/System.out(3685): waiting for debugger to settle...
04-23 06:57:25.188: I/System.out(3685): waiting for debugger to settle...
04-23 06:57:25.388: I/System.out(3685): waiting for debugger to settle...
04-23 06:57:25.668: I/System.out(3685): debugger has settled (1447)
04-23 06:57:27.108: W/dalvikvm(3685): VFY: unable to resolve static field 873 (MapAttrs) in Lcom/google/android/gms/R$styleable;
04-23 06:57:27.108: D/dalvikvm(3685): VFY: replacing opcode 0x62 at 0x000e
04-23 07:14:55.779: I/jdwp(3685): Ignoring second debugger -- accepting and dropping
04-23 07:19:31.823: E/Trace(6321): error opening trace file: No such file or directory (2)
04-23 07:19:31.949: W/ActivityThread(6321): Application com.example.findproperty is waiting for the debugger on port 8100...
04-23 07:19:32.069: I/System.out(6321): Sending WAIT chunk
04-23 07:19:32.089: I/dalvikvm(6321): Debugger is active
04-23 07:19:32.278: I/System.out(6321): Debugger has connected
04-23 07:19:32.278: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:32.503: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:32.709: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:32.909: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:33.109: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:33.325: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:33.528: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:33.728: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:33.948: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:34.148: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:34.448: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:34.648: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:34.850: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:35.048: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:35.258: I/System.out(6321): waiting for debugger to settle...
04-23 07:19:35.538: I/System.out(6321): debugger has settled (1440)
04-23 07:19:41.869: W/GooglePlayServicesUtil(6321): Google Play services out of date. Requires 3027100 but found 2012110
04-23 07:19:41.929: W/GooglePlayServicesUtil(6321): Google Play services out of date. Requires 3027100 but found 2012110
04-23 07:19:41.989: W/GooglePlayServicesUtil(6321): Google Play services out of date. Requires 3027100 but found 2012110
04-23 07:19:42.059: W/GooglePlayServicesUtil(6321): Google Play services out of date. Requires 3027100 but found 2012110
04-23 07:19:42.119: W/GooglePlayServicesUtil(6321): Google Play services out of date. Requires 3027100 but found 2012110
04-23 07:19:42.399: D/dalvikvm(6321): GC_CONCURRENT freed 202K, 12% free 2591K/2916K, paused 103ms+13ms, total 208ms
04-23 07:19:45.879: W/GooglePlayServicesUtil(6321): Google Play services out of date. Requires 3027100 but found 2012110
04-23 07:30:43.240: W/ActivityThread(7607): Application com.example.findproperty is waiting for the debugger on port 8100...
04-23 07:30:43.318: I/System.out(7607): Sending WAIT chunk
04-23 07:30:43.339: I/dalvikvm(7607): Debugger is active
04-23 07:30:43.518: I/System.out(7607): Debugger has connected
04-23 07:30:43.528: I/System.out(7607): waiting for debugger to settle...
04-23 07:30:43.728: I/System.out(7607): waiting for debugger to settle...
04-23 07:30:43.938: I/System.out(7607): waiting for debugger to settle...
04-23 07:30:44.138: I/System.out(7607): waiting for debugger to settle...
04-23 07:30:44.348: I/System.out(7607): waiting for debugger to settle...
04-23 07:30:44.548: I/System.out(7607): waiting for debugger to settle...
04-23 07:30:44.748: I/System.out(7607): waiting for debugger to settle...
04-23 07:30:45.040: I/System.out(7607): waiting for debugger to settle...
04-23 07:30:45.238: I/System.out(7607): waiting for debugger to settle...
04-23 07:30:45.440: I/System.out(7607): waiting for debugger to settle...
04-23 07:30:45.640: I/System.out(7607): waiting for debugger to settle...
04-23 07:30:45.848: I/System.out(7607): debugger has settled (1384)
04-23 07:30:47.689: W/GooglePlayServicesUtil(7607): Google Play services out of date. Requires 3027100 but found 2012110
04-23 07:30:47.739: W/GooglePlayServicesUtil(7607): Google Play services out of date. Requires 3027100 but found 2012110
04-23 07:30:47.799: W/GooglePlayServicesUtil(7607): Google Play services out of date. Requires 3027100 but found 2012110
04-23 07:30:47.939: W/GooglePlayServicesUtil(7607): Google Play services out of date. Requires 3027100 but found 2012110
04-23 07:30:48.009: W/GooglePlayServicesUtil(7607): Google Play services out of date. Requires 3027100 but found 2012110
04-23 07:30:48.359: D/dalvikvm(7607): GC_CONCURRENT freed 206K, 12% free 2583K/2912K, paused 92ms+24ms, total 230ms
04-23 07:31:04.578: W/GooglePlayServicesUtil(7607): Google Play services out of date. Requires 3027100 but found 2012110
清单文件,
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission
android:name="com.example.findproperty.permission.MAPS_RECEIVE"
/>
<uses-permission android:name="com.example.findproperty.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.findproperty.MainActivity"
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" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="Given the key" />
</application>
</manifest>
请帮我解决这个问题!!!
答案 0 :(得分:0)
如果您在模拟器上运行此功能,那么您推送到AVD
的Google地图文件已经过时,并且与您可能正在使用的google-play-services
库的最新版本不兼容。< / p>
如果您在真实设备上运行此操作,请通过google-play-service
更新Play Store
。
要更新,请点击此链接:https://play.google.com/store/apps/details?id=com.google.android.gms&hl=en
答案 1 :(得分:0)
打开Eclipse .. 在窗口菜单中 - &gt;点击 Android SDK Manager 打开 Android SDK Manager 后,请参阅最后一个标签额外。 查看 Google Play服务选项和更新它..