我试图建立官方 Android的谷歌地图API V2 样品上(姜饼2.3.5)手机。
我加了 Android的支持 - v4.jar
官方示例项目。
I'm trying to build the official android google map api v2 sample on a (gingerbread 2.3.5) phone .
I added android-support-v4.jar
to official sample project.
我从官方教程中的样本中< Android的SDK> /演员/谷歌播放服务/样本/图
I took the sample from the official tutorial in <android-sdk>/extras/google-play-services/samples/maps
我复制Eclipse中的示例应用程序,引用谷歌播放services_lib
项目作为一个Android库,并使用Android SDK 4.1.2建立整个事情( API 16)。
I copied the sample app in Eclipse, reference the google-play-services_lib
project as an Android library, and build the whole thing with the Android SDK 4.1.2 (api 16).
不幸的是,AHEN我启动应用程序的地图是空白的,我没有任何异常或消息。 我得到的唯一的事情是在logcat中的可疑行:
Unfortunately, ahen I launch the app the map is blank and I don't have any exception or message. The only thing I got are those suspicious lines in the 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
ERR找不到类的maps.j.k,从法maps.y.ae.a 引用 VFY:无法解析新实例3571(Lmaps / J / K;)在Lmaps / Y / AE;
ERR Could not find class 'maps.j.k', referenced from method maps.y.ae.a VFY: unable to resolve new-instance 3571 (Lmaps/j/k;) in Lmaps/y/ae;
我怀疑我在Eclipse 3.8项目结构有点混乱。
I suspect that my project structure in eclipse 3.8 is somewhat messed up.
我想下面的东西(即使是最愚蠢的),也没有用。
I tried the following things (even the most idiotic) to no avail.
我产生了debug.keystore使用keytool并更新了日食preference(安卓/生成/密钥库)。 当然,我注册了新的密钥库/ SHA1,并得到了我所用的AndroidManifest文件中一个新的API密钥
I generated a "debug.keystore" with keytool and updated the eclipse preference (Android/Build/Keystore). Of course, I registered that new keystore/SHA1 and get a new api key that I used in the AndroidManifest file
我试着用下面的目标建立我的两个项目:
I tried to build my two projects with the following targets :
安卓4.2.1 在谷歌阿比4.2.1我尝试添加谷歌播放,services_lib作为被添加为演示构建路径的机器人库顶部的项目依赖。 并勾选匹配的导出复选框。
I tried to add google-play-services_lib as a project dependency on top of being added as an android library in the demo build path. And tick the matching export checkbox.
我下载 Trulia的房地产的应用程序,据说使用V2 API在手机上,以确保手机与新的API
I downloaded trulia real estate app that is said to use the v2 api on the phone to be sure that the phone is compatible with the new 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>
下面是我的项目结构的一些截图/构建路径。
Here are some screenshots of my project structure/build path.
我有完全相同的问题(所有配置中的logcat相同,maps.jk的东西)。然而,我选择谷歌的API为构建目标解决了这个问题。但是,这是谷歌API的4.2,所以我建议大家安装更新,并尝试与最近的目标。
I had exactly the same problem (all configurations the same, maps.j.k stuff in the logcat). However, for me choosing Google APIs as build target solved it. But that was Google APIs 4.2, so I suggest that you install the update and try with the more recent target.