无法从github获取任何带有地图的Android应用程序才能正常运行

时间:2014-05-12 15:43:02

标签: android google-maps samsung-mobile

我一直在努力让像this这样的应用程序正常运行,当我运行它们时,一切都会有效,除了谷歌地图。我已经将我的API密钥复制到它们中但仍无济于事。还有什么我错过了吗?

尝试运行时遇到错误:

<terminated>CustomMarker [Android Application]  
    <disconnected>DalvikVM[localhost:8607]  

<disconnected>DalvikVM[localhost:8607]  

感谢任何帮助。
PS我在Android手机上运行它们,而不是模拟器,我怀疑它可能是手机有问题吗? 编辑:更多详情

[2014-05-12 16:31:57 - CustomMarker] ------------------------------
[2014-05-12 16:31:57 - CustomMarker] Android Launch!
[2014-05-12 16:31:57 - CustomMarker] adb is running normally.
[2014-05-12 16:31:57 - CustomMarker] Performing com.nasc.sample.custommarker.CustomMapMarker activity launch
[2014-05-12 16:31:57 - CustomMarker] Failed to find an AVD compatible with target 'Android 4.2.2'.
[2014-05-12 16:31:58 - CustomMarker] Performing com.nasc.sample.custommarker.CustomMapMarker activity launch
[2014-05-12 16:33:12 - CustomMarker] Uploading CustomMarker.apk onto device '4df190e00d8b5f4d'
[2014-05-12 16:33:12 - CustomMarker] Installing CustomMarker.apk...
[2014-05-12 16:33:21 - CustomMarker] Success!
[2014-05-12 16:33:21 - CustomMarker] Starting activity com.nasc.sample.custommarker.CustomMapMarker on device 4df190e00d8b5f4d
[2014-05-12 16:33:22 - CustomMarker] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.nasc.sample.custommarker/.CustomMapMarker }
[2014-05-12 16:33:23 - CustomMarker] Attempting to connect debugger to 'com.nasc.sample.custommarker' on port 8607

更多详情:

Description Resource    Path    Location    Type
Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details.    AndroidManifest.xml /CustomMarker   line 7  Android Lint Problem
The method removeGlobalOnLayoutListener(ViewTreeObserver.OnGlobalLayoutListener) from the type ViewTreeObserver is deprecated   CustomMapMarker.java    /CustomMarker/src/com/nasc/sample/custommarker  line 76 Java Problem
The value of the field CustomMapMarker.customMarker is not used CustomMapMarker.java    /CustomMarker/src/com/nasc/sample/custommarker  line 29 Java Problem

2 个答案:

答案 0 :(得分:0)

您发布的内容充其量只是来自控制台的内容,并不会对您有所帮助。使用LogCat检查Java堆栈跟踪。

如果没有其他内容,该示例已足够大,以至于缺少Play服务版本的第二个<meta-data>元素:

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>

a directory full of samples是您可以尝试的最新版本,例如the basic sample

答案 1 :(得分:0)

即使您将API密钥复制到项目中,也需要将应用程序的软件包名称和您使用的密钥库中的SHA1密钥添加到Google API控制台。这大约需要15分钟才能上线。

请注意,您可以拥有多个与SHA1密钥关联的软件包,并且可以将软件包与多个SHA1密钥相关联。您只需要在API控制台中分隔每一行

要在Google Developer Console中执行此操作,请转到您正在处理的项目 - &gt; API&amp; auth - &gt;确保Google Maps Android API V2处于开启状态,然后点击它 - &gt;凭证 - &gt;在公共API访问下,找到Android应用程序的密钥 - &gt;编辑允许的Android应用程序

在此窗口中,每行添加一个SHA1键和一个包名,SHA1和包用分号分隔:

FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:F0;com.example.yourproject
FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:F1;com.example.anotherproject