Google MapFragment为空白(白色),找不到类'maps.jk'

Nam*_*arl 16 android google-maps

我正在尝试在(姜饼2.3.5)手机上构建官方Android谷歌地图api v2样本.我加入android-support-v4.jar了官方样本项目.

我从官方教程中取样 <android-sdk>/extras/google-play-services/samples/maps

我在Eclipse中复制了示例应用程序,将google-play-services_lib项目作为Android库引用,并使用Android SDK 4.1.2(api 16)构建整个项目.

不幸的是,我启动应用程序时地图是空白的,我没有任何异常或消息.我唯一得到的是logcat中可疑的行:

    Unable to resolve superclass of Lmaps/a/du; (411)                     
    Link of class 'Lmaps/a/du;' failed                                    
    Unable to resolve superclass of Lmaps/a/ej; (2363)                    
    Link of class 'Lmaps/a/ej;' failed                                    
    Unable to resolve superclass of Lmaps/j/k; (2379)                     
    Link of class 'Lmaps/j/k;' failed                                     
Run Code Online (Sandbox Code Playgroud)

ERR找不到类'maps.j.k',从方法maps.y.ae.a引用.VFY
:无法解析Lmaps/y/ae中的新实例3571(Lmaps/j/k;);

我怀疑我在eclipse 3.8中的项目结构有些搞砸了.

我试过以下的事情(即使是最愚蠢的)也无济于事.

1.无效的api密钥?

我使用keytool生成了一个"debug.keystore"并更新了eclipse首选项(Android/Build/Keystore).当然,我注册了新的密钥库/ SHA1并获得了我在AndroidManifest文件中使用的新api密钥

2.错误的项目目标?

我尝试使用以下目标构建我的两个项目:

  • Android 4.2.1
  • Google Api 4.2.1

3.添加google-play-services_lib作为项目依赖项

我尝试将google-play-services_lib添加为项目依赖项,并在演示构建路径中添加为android库.勾选匹配的导出复选框.

4.在手机上测试google maps api v2

我下载了trulia房地产应用程序,据说在手机上使用v2 api以确保手机与新api兼容

这是示例应用程序的清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.mapdemo"
    android:versionCode="1"
    android:versionName="1.0" >
    <permission
        android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />
    <uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE" />
    <!-- Copied from Google Maps Library/AndroidManifest.xml. -->
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <!-- External storage for caching. -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!-- My Location -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <!-- Maps API needs OpenGL ES 2.0. -->
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />
    <!-- End of copy. -->
    <application
        android:hardwareAccelerated="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/demo_title" >
        <!-- You must insert your own Google Maps for Android API v2 key in here. -->
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="XXXXXXXX" />
        <activity android:name=".MainActivity" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".BasicMapActivity"
            android:label="@string/basic_map" />
        <activity
            android:name=".CameraDemoActivity"
            android:label="@string/camera_demo" />
        <activity
            android:name=".EventsDemoActivity"
            android:label="@string/events_demo" />
        <activity
            android:name=".GroundOverlayDemoActivity"
            android:label="@string/groundoverlay_demo" />
        <activity
            android:name=".LayersDemoActivity"
            android:label="@string/layers_demo" />
        <activity
            android:name=".LocationSourceDemoActivity"
            android:label="@string/locationsource_demo" />
        <activity
            android:name=".MarkerDemoActivity"
            android:label="@string/marker_demo" />
        <activity
            android:name=".OptionsDemoActivity"
            android:label="@string/options_demo" />
        <activity
            android:name=".PolygonDemoActivity"
            android:label="@string/polygon_demo" />
        <activity
            android:name=".PolylineDemoActivity"
            android:label="@string/polyline_demo" />
        <activity
            android:name=".ProgrammaticDemoActivity"
            android:label="@string/programmatic_demo" />
        <activity
            android:name=".TileOverlayDemoActivity"
            android:label="@string/tile_overlay_demo" />
        <activity
            android:name=".UiSettingsDemoActivity"
            android:label="@string/uisettings_demo" />
        <activity
            android:name=".RawMapViewDemoActivity"
            android:label="@string/raw_mapview_demo" />
        <activity
            android:name=".RetainMapActivity"
            android:label="@string/retain_map" />
        <activity
            android:name=".MultiMapDemoActivity"
            android:label="@string/multi_map_demo" />
    </application>
</manifest>
Run Code Online (Sandbox Code Playgroud)

以下是我的项目结构/构建路径的一些截图.

项目结构

目标和图书馆

建立路径

use*_*874 15

我想也许你在应用api KEY时出错了.我有同样的问题,最后我发现我打开了错误的服务.在https://code.google.com/apis/console/,

Google Maps API v2Google Maps Android API v2.

你应该用Google Maps Android API v2.


小智 4

我遇到了完全相同的问题(所有配置都相同,logcat 中的maps.jk 内容)。然而,对我来说,选择 Google API 作为构建目标解决了这个问题。但那是 Google API 4.2,因此我建议您安装更新并尝试使用更新的目标。