gpt4 book ai didi

android - MapView google maps api V2 看起来空白,只显示带有 +/- 按钮的网格

转载 作者:行者123 更新时间:2023-11-29 21:13:35 24 4
gpt4 key购买 nike

我完成了所有步骤,我将 google-play-services 添加到我的项目中,我做了所有事情。我不知道有什么问题。我使用 SHA1 使用调试证书指纹创建我的 api key eclipse windows > 首选项 > android 中的指纹;我正在使用 lg E400 con android 2.3.6

主要 Activity :

import android.os.Bundle;
import android.app.Activity;


import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.MapsInitializer;

public class MainActivity extends Activity {
GoogleMap map;
MapView m;
com.google.android.gms.maps.Projection projection;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
m=(MapView) findViewById(R.id.mapview);
m.onCreate(savedInstanceState);
map = m.getMap();
if (map != null) {
// The Map is verified. It is now safe to manipulate the map.

}else{
// check if google play service in the device is not available or out-dated.
GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);

// nothing anymore, cuz android will take care of the rest (to remind user to update google play service).
}

try{map.getUiSettings().setMyLocationButtonEnabled(false);
map.setMyLocationEnabled(true);
}catch(Exception ex){ex.printStackTrace();}

MapsInitializer.initialize(this);

}
@Override
public void onResume() {

super.onResume();
m.onResume();
}
@Override
public void onDestroy() {
super.onDestroy();
m.onDestroy();
}
@Override
public void onLowMemory() {

super.onLowMemory();
m.onLowMemory();
}
@Override
public void onSaveInstanceState(Bundle outState){
super.onSaveInstanceState(outState);
m.onSaveInstanceState(outState);
}
}

布局:

<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"
tools:context=".MainActivity" >


<com.google.android.gms.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>

</RelativeLayout>

list :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.voicesee"

android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="15" />

<permission
android:name="com.example.voicesee.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />

<uses-permission android:name="com.example.voicesee.permission.MAPS_RECEIVE" />
<!-- Copied from Google Maps Library/AndroidManifest.xml. -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<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" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />


<activity
android:name="com.example.voicesee.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>

<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyAguDjIFiVWi18ll7Yh0oa8C7hWju1PUzI"/>


</application>

感谢帮助!!

最佳答案

我遇到了类似的问题,我的问题是因为我选择了错误的调试 keystore 。我正在使用 ubuntu 机器。由于我以 root 身份打开 eclipse,因此 eclipse 中的默认 keystore 位于我的根文件夹 (/root/.android/.android/debug.keystore) 中,而我正在使用用户文件夹中的调试 keystore 创建 api key 。我已经添加了一个链接到已回答的问题: Google Maps V2 shows blank screen on android 2.2

关于android - MapView google maps api V2 看起来空白,只显示带有 +/- 按钮的网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22045223/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com