gpt4 book ai didi

java - 谷歌地图 Android 仅显示白屏

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:27:33 26 4
gpt4 key购买 nike

我执行了所有程序来添加 google maps api,但出现此错误。抱歉语言不好。

09 12:20:55.359: W/dalvikvm(5918): Unable to resolve superclass of Lmaps/a/du; (406)
01-09 12:20:55.359: W/dalvikvm(5918): Link of class 'Lmaps/a/du;' failed
01-09 12:20:55.359: W/dalvikvm(5918): Unable to resolve superclass of Lmaps/a/ej; (2358)
01-09 12:20:55.359: W/dalvikvm(5918): Link of class 'Lmaps/a/ej;' failed
01-09 12:20:55.359: W/dalvikvm(5918): Unable to resolve superclass of Lmaps/j/k; (2374)
01-09 12:20:55.359: W/dalvikvm(5918): Link of class 'Lmaps/j/k;' failed
01-09 12:20:55.359: E/dalvikvm(5918): Could not find class 'maps.j.k', referenced from method maps.y.ae.a
01-09 12:20:55.359: W/dalvikvm(5918): VFY: unable to resolve new-instance 3566 (Lmaps/j/k;) in Lmaps/y/ae;

这是 manifest.xml

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="com.comparto.piso.permission.MAPS_RECEIVE" />
<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" />

<permission
android:name="com.comparto.piso.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />

<application
........ >
<uses-library android:name="com.google.android.maps" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="api key" />
......
.....

在 java 代码中,我扩展了 FragmentActivity,这里是 onCreate 代码

GooglePlayServicesUtil
.isGooglePlayServicesAvailable(getApplicationContext());

GoogleMap map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
if (map != null) {
map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
}

这里是布局xml

 <fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="300px"
class="com.google.android.gms.maps.SupportMapFragment" />

最佳答案

如果您的设备与 Google Maps 库使用的 API 级别不同,则 logcat 中来自 Dalvik 的所有“无法解析父类(super class) xxxx”和“类 xxxx 的链接失败”都是正常的。

您应该使用以下命令检查您是否获得授权失败:

adb logcat | grep Maps

如果你看到这样的东西:

E/Google Maps Android API(): Authorization failure.

那么这意味着您没有在 list 中提供正确的 API key 。再次检查您的 Google API Console (在 API 访问 部分)您是否添加了正确的指纹和包名称对作为 described in the guide .

关于java - 谷歌地图 Android 仅显示白屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14237390/

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