Android Google Map v2挂起,灰色屏幕正在加载
我试图在模拟器上的子片段中显示Google地图。但问题是,当地图像这样加载时,emulator会随着toast的不断显示而冻结: 我已经检查了清单文件,重新创建了API密钥和debug.keystore。但它仍然不起作用。请告诉我如何处理这个问题。谢谢 **注:*我正在Genymotion emulator-Galaxy S2 API 10(2.3.7)上进行测试。Google play服务已经安装在emulator上 AndroidManifest.xmlAndroid Google Map v2挂起,灰色屏幕正在加载,android,google-maps,genymotion,Android,Google Maps,Genymotion,我试图在模拟器上的子片段中显示Google地图。但问题是,当地图像这样加载时,emulator会随着toast的不断显示而冻结: 我已经检查了清单文件,重新创建了API密钥和debug.keystore。但它仍然不起作用。请告诉我如何处理这个问题。谢谢 **注:*我正在Genymotion emulator-Galaxy S2 API 10(2.3.7)上进行测试。Google play服务已经安装在emulator上 AndroidManifest.xml MapFragment.jav
MapFragment.java
public class MapFragmentClass extends Fragment implements GooglePlayServicesClient.ConnectionCallbacks,GooglePlayServicesClient.OnConnectionFailedListener,LocationListener {
//to extract current loc
private LocationClient locationclient;
private LocationRequest locationrequest;
SupportMapFragment mapFragment;
GoogleMap map;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.map_fragment, null);
return view;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onViewCreated(view, savedInstanceState);
FragmentManager fm = getChildFragmentManager();
mapFragment = (SupportMapFragment) fm.findFragmentById(R.id.map);
if (mapFragment == null) {
mapFragment = SupportMapFragment.newInstance();
fm.beginTransaction().replace(R.id.map, mapFragment).commit();
fm.executePendingTransactions();
delayMapLoading();
}
}
void delayMapLoading()
{
Handler handler = new Handler();
handler.postDelayed(new Runnable()
{
@Override
public void run() {
map = mapFragment.getMap();
if(map != null)
{
Log.i("MSG","map is not null");
map.setMyLocationEnabled(true);
map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
}
else {
// handler.postDelayed(this, 500);
}
}
}, 1000);
}
map_fragment.xml
如果您创建了
debug.keystore
,那么您是否使用相同的keystore路径导出了应用程序
我认为你不必导出你的应用程序
Please export your app with same keystore which is created ..
我希望您解决了问题。更改地图\u fragment.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical" >
<FrameLayout android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.03"
android:name="com.google.android.gms.maps.SupportMapFragment" />
</LinearLayout>
到
谢谢您的回复。我现在不能查。半天后会通知你的。是的,没问题!!我不明白。导出具有相同密钥库路径的应用程序是什么意思?你能详细说明一下吗?请创建密钥库并将其用于导出应用程序。右键单击项目->导出->确定。我很可能会在10-12小时后检查并通知您。谢谢。我为我的应用程序创建了新的密钥库并签署了apk。现在mapview正在显示。我面临同样的问题。我不明白“创建密钥库并将其用于导出应用程序。右键单击proejct->export->”这句话。请详细说明。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical" >
<fragment android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.03"
android:name="com.google.android.gms.maps.SupportMapFragment" />
</LinearLayout>