Java 谷歌地图不仅仅出现在黑屏上
我制作了一个典型的谷歌地图应用程序。它在大约2个月内运行良好,但昨晚我想添加更多功能,结果谷歌地图并没有出现,只有一个黑屏。我的应用程序没有吐出任何错误,除了谷歌地图被黑屏取代外,其他一切都正常。为什么会这样?有什么想法吗 它可以在模拟器上正常工作,但在我的手机上不行 谷歌地图活动Java 谷歌地图不仅仅出现在黑屏上,java,android,google-maps,gps,Java,Android,Google Maps,Gps,我制作了一个典型的谷歌地图应用程序。它在大约2个月内运行良好,但昨晚我想添加更多功能,结果谷歌地图并没有出现,只有一个黑屏。我的应用程序没有吐出任何错误,除了谷歌地图被黑屏取代外,其他一切都正常。为什么会这样?有什么想法吗 它可以在模拟器上正常工作,但在我的手机上不行 谷歌地图活动 public class GoogleMaps extends MapActivity implements LocationListener { @Override public void onCreate(B
public class GoogleMaps extends MapActivity implements LocationListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent1 = new Intent(this, BackGroundService.class);
stopService(intent1);
setContentView(R.layout.googlemaps);
map = (MapView) findViewById(R.id.mvGoogleMaps);
Touchy t = new Touchy();
overlayList = map.getOverlays();
overlayList.add(t);
ourLocation();
d = getResources().getDrawable(R.drawable.round_pointer);
Criteria crit = new Criteria();
towers = locationManager.getBestProvider(crit, false);
Location location = locationManager.getLastKnownLocation(towers);
nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nm.cancel(uniqueID);
}
谷歌地图布局
<com.google.android.maps.MapView
android:id="@+id/mvGoogleMaps"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="My APY Key"
android:clickable="true"
android:enabled="true" />
显示
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.rememberforme"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<application
android:allowBackup="true"
android:icon="@drawable/round_pointer"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name="com.example.rememberforme.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>
<activity android:name="com.example.rememberforme.GoogleMaps" >
</activity>
<activity android:name="com.example.IkkeImplementeret.Situationer" >
</activity>
<activity android:name="com.example.IkkeImplementeret.Tid" >
</activity>
<activity android:name="com.example.rememberforme.Locations" >
</activity>
<service
android:name="com.example.rememberforme.BackGroundService"
android:enabled="true"
android:exported="false"
android:label="LocationLoggerService" />
</application>
</manifest>
您确定使用了正确的api密钥吗:android:apiKey=“My APY Key”是最近添加的Touchy
覆盖中的一个?如果是这样,请确保它不是完全不透明的。