谷歌地图未在android中显示
我用android开发了一个应用程序,它使用谷歌地图显示用户所在位置附近的购物中心列表 这是我实现它的代码谷歌地图未在android中显示,android,google-maps,google-maps-api-3,Android,Google Maps,Google Maps Api 3,我用android开发了一个应用程序,它使用谷歌地图显示用户所在位置附近的购物中心列表 这是我实现它的代码 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<org.fluturasymphony.recommendation.StoreMapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0aHtkSh4B8Ub3ELLFUMRWJD23wpEWJAsFxL-ilw"
/>
</RelativeLayout>
但是当我运行模拟器时,我会看到一个像这样的空白屏幕。我怎样才能修好它
告诉我我做错了什么
嗨,我现在有一个日志猫错误
01-03 07:28:02.585:E/MapActivity(3823):无法获取连接工厂客户端
01-03 07:30:26.165:E/MapActivity(12298):无法获取连接工厂客户端
我的android清单文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fluturasymphony.recommendation"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="9"
android:targetSdkVersion="11" />
<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" />
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name">
<activity android:label="@string/app_name" android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="org.achartengine.GraphicalActivity" />
<activity android:name=".CategoryWiseSalesChartActivity" />
<activity android:name=".ProductWiseSalesChartActivity" />
<activity android:label="@string/home_screen" android:name=".HomeActivity" android:configChanges="orientation">
</activity>
<activity android:label="@string/store_screen" android:name=".StoreActivity" android:configChanges="orientation">
</activity>
<activity android:label="@string/store_list_screen" android:name=".StoreListActivity" android:configChanges="orientation">
</activity>
<activity android:label="@string/location_screen" android:name=".StoreMapActivity" android:configChanges="orientation">
</activity>
<activity android:label="@string/recommended_products_list_screen" android:name=".RecommendedProductsListActivity" android:configChanges="orientation">
</activity>
<activity android:label="@string/category_wise_sales_screen" android:name=".CategoryWiseSalesActivity" android:configChanges="orientation">
</activity>
<activity android:label="@string/product_wise_sales_screen" android:name=".ProductWiseSalesActivity" android:configChanges="orientation">
</activity>
<uses-library android:name="com.google.android.maps" />
</application>
</manifest>
请生成新的安卓地图密钥,然后用XML替换此密钥…可能是问题是密钥未正确生成…请生成新的安卓地图密钥,然后用XML替换此密钥…可能是问题是密钥未正确生成…我认为您的安卓地图api密钥未正确生成,然后继续此操作链接并获取谷歌地图api密钥,
我认为您的android地图api密钥生成不正确,然后您只需点击此链接获取google地图api密钥,
logcat上有消息吗?logcat@hkutluayare中没有消息,您正在谷歌api模拟器中测试吗?是的,我正在谷歌api模拟器中测试,您可以提供您正在使用的软件包的链接吗?logcat上有消息吗?logcat@hkutluayare中没有消息,您正在谷歌api模拟器中测试吗?是的,我正在谷歌api中测试你能给你正在使用的软件包一个链接吗?
public class StoreMapView extends MapView
{
// ------------------------------------------------------------------------
// LISTENER DEFINITIONS
// ------------------------------------------------------------------------
// Change listener
public interface OnChangeListener
{
public void onChange(MapView view, GeoPoint newCenter, GeoPoint oldCenter, int newZoom, int oldZoom);
}
// ------------------------------------------------------------------------
// MEMBERS
// ------------------------------------------------------------------------
private StoreMapView mThis;
private long mEventsTimeout = 250L; // Set this variable to your preferred timeout
private boolean mIsTouched = false;
private GeoPoint mLastCenterPosition;
private int mLastZoomLevel;
//private Timer mChangeDelayTimer = new Timer();
private StoreMapView.OnChangeListener mChangeListener = null;
// ------------------------------------------------------------------------
// RUNNABLES
// ------------------------------------------------------------------------
private Runnable mOnChangeTask = new Runnable()
{
@Override
public void run()
{
if (mChangeListener != null) mChangeListener.onChange(mThis, getMapCenter(), mLastCenterPosition, getZoomLevel(), mLastZoomLevel);
mLastCenterPosition = getMapCenter();
mLastZoomLevel = getZoomLevel();
}
};
// ------------------------------------------------------------------------
// CONSTRUCTORS
// ------------------------------------------------------------------------
public StoreMapView(Context context, String apiKey)
{
super(context, apiKey);
init();
}
public StoreMapView(Context context, AttributeSet attrs)
{
super(context, attrs);
init();
}
public StoreMapView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
init();
}
private void init()
{
mThis = this;
mLastCenterPosition = this.getMapCenter();
mLastZoomLevel = this.getZoomLevel();
}
// ------------------------------------------------------------------------
// GETTERS / SETTERS
// ------------------------------------------------------------------------
public void setOnChangeListener(StoreMapView.OnChangeListener l)
{
mChangeListener = l;
}
// ------------------------------------------------------------------------
// EVENT HANDLERS
// ------------------------------------------------------------------------
@Override
public boolean onTouchEvent(MotionEvent ev)
{
// Set touch internal
mIsTouched = (ev.getAction() != MotionEvent.ACTION_UP);
return super.onTouchEvent(ev);
}
@Override
public void computeScroll()
{
super.computeScroll();
// Check for change
if (isSpanChange() || isZoomChange())
{
// If computeScroll called before timer counts down we should drop it and
// start counter over again
resetMapChangeTimer();
}
}
// ------------------------------------------------------------------------
// TIMER RESETS
// ------------------------------------------------------------------------
private void resetMapChangeTimer()
{
StoreMapView.this.removeCallbacks(mOnChangeTask);
StoreMapView.this.postDelayed(mOnChangeTask, mEventsTimeout);
}
// ------------------------------------------------------------------------
// CHANGE FUNCTIONS
// ------------------------------------------------------------------------
private boolean isSpanChange()
{
return !mIsTouched && !getMapCenter().equals(mLastCenterPosition);
}
private boolean isZoomChange()
{
return (getZoomLevel() != mLastZoomLevel);
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fluturasymphony.recommendation"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="9"
android:targetSdkVersion="11" />
<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" />
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name">
<activity android:label="@string/app_name" android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="org.achartengine.GraphicalActivity" />
<activity android:name=".CategoryWiseSalesChartActivity" />
<activity android:name=".ProductWiseSalesChartActivity" />
<activity android:label="@string/home_screen" android:name=".HomeActivity" android:configChanges="orientation">
</activity>
<activity android:label="@string/store_screen" android:name=".StoreActivity" android:configChanges="orientation">
</activity>
<activity android:label="@string/store_list_screen" android:name=".StoreListActivity" android:configChanges="orientation">
</activity>
<activity android:label="@string/location_screen" android:name=".StoreMapActivity" android:configChanges="orientation">
</activity>
<activity android:label="@string/recommended_products_list_screen" android:name=".RecommendedProductsListActivity" android:configChanges="orientation">
</activity>
<activity android:label="@string/category_wise_sales_screen" android:name=".CategoryWiseSalesActivity" android:configChanges="orientation">
</activity>
<activity android:label="@string/product_wise_sales_screen" android:name=".ProductWiseSalesActivity" android:configChanges="orientation">
</activity>
<uses-library android:name="com.google.android.maps" />
</application>
</manifest>