简体   繁体   English

如何在Android应用程序com.google.android.gms.maps.GoogleMap中导入此程序包(库)

[英]how can i import this packages (Libraries) in my android application com.google.android.gms.maps.GoogleMap

how can i import this packages (Libraries) in my android application 我如何在我的android应用程序中导入此包(库)

com.google.android.gms.maps.GoogleMap;

when i add this in my Application it will show as an error 当我在应用程序中添加它时,它将显示为错误

but this imports are successful 但是这种导入是成功的

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;
import android.view.Menu;

i used Eclipse kepler, compile with SDK API Google API(Google Inc.)API 19 minimum API level 14 already add Google APIs[Android[4.4] maps.jar i used Google Maps Android APIv2 in manifest file declare all permissions as follow 我使用Eclipse kepler,使用SDK API进行了编译Google API(Google Inc.)API 19最低API级别14已添加Google APIs [Android [4.4] maps.jar)我在清单文件中使用了Google Maps Android APIv2,声明所有权限如下

<uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

    <permission
     android:name="com.example.googlenewmap.permission.MAPS_RECEIVE"/>

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission
        android:name =  "com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="com.example.googlenewmap.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

and add MapAPI key obtain from https://code.google.com/apis/console and add into my layout file as follow 并添加从https://code.google.com/apis/console获取的MapAPI密钥,并如下所示添加到我的布局文件中

<com.google.android.maps.MapView
    android:id="@+id/mapView"
    android:layout_width="match_parent
    android:layout_height="match_parent"
    android:clickable="true"
    android:enabled="true"
    android:apiKey = "I have My APIKey here" />

i get only grids in my emulator as output and console shows this error 11-28 04:04:57.535: E/MapActivity(1555): Couldn't get connection factory client 我在仿真器中仅得到网格作为输出,并且控制台显示此错误11-28 04:04:57.535:E / MapActivity(1555):无法获得连接工厂客户端

i can't understand the full meaning of this error 'coz i am new in android so please guys help me out here. 我无法理解此错误的全部含义,因为我是android的新手,所以请大家在这里帮助我。 thankx in advance 预先感谢

As to your description 至于你的描述

import com.google.android.maps.MapActivity; 导入com.google.android.maps.MapActivity;
import com.google.android.maps.MapView; 导入com.google.android.maps.MapView;

This is not in the right track, which should be 这是不正确的,应该是

import com.google.android.gms.maps.MapView; 导入com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.MapFragment; 导入com.google.android.gms.maps.MapFragment;

  1. Make sure you have import the project "google-play-serviceslib" into Eclipse. 确保已将项目“ google-play-serviceslib”导入Eclipse。
  2. Right click your project -> Properties -> "Android" item on the left -> "Add..." a library. 右键单击您的项目->属性->左侧的“ Android”项目->“添加...”一个库。

Just like: 就像: 在此处输入图片说明

I think the problem is that you haven't import/include/setup the Google Play Services Library. 我认为问题在于您尚未导入/包含/设置Google Play服务库。 This link will provide you with the steps to follow to achieve it. 该链接将为您提供实现它的步骤。 Next You should also check this page . 下一步您还应该检查此页面 It is the updated documentation to include Google Maps on your Project. 这是更新的文档,将Google Maps包含在您的项目中。 You have already done some of them, but it seems that you missed some things too. 您已经完成了其中一些操作,但是似乎您也错过了一些操作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用“com.google.android.gms.maps.GoogleMap”,我可以像在 maps.google.com 上一样绘制路线吗? - Using “com.google.android.gms.maps.GoogleMap”, can I draw a route as I can on maps.google.com? com.google.android.gms.maps.GoogleMap com.google.android.gms.maps.MapFragment.getMap()&#39;对空对象的引用 - com.google.android.gms.maps.GoogleMap com.google.android.gms.maps.MapFragment.getMap()' on a null object reference Android:使用com.google.android.gms.maps.GoogleMap设置区域的默认缩放级别 - Android : Setting default zoom level for an area with com.google.android.gms.maps.GoogleMap com.sun.tools.javac.code.Symbol$CompletionFailure: class file for com.google.android.gms.maps.GoogleMap not found - com.sun.tools.javac.code.Symbol$CompletionFailure: class file for com.google.android.gms.maps.GoogleMap not found 如何在Android上的GoogleMap中修复com.google.android.gms.maps.model.Marker com.google.android.gms.maps.GoogleMap.addMarker - How to fix com.google.android.gms.maps.model.Marker com.google.android.gms.maps.GoogleMap.addMarker in GoogleMap on Android com.google.android.gms.maps.GoogleMap.SnapshotReadyCallback无法解析 - com.google.android.gms.maps.GoogleMap.SnapshotReadyCallback cannot be resolved com.google.android.gms.maps.GoogleMap.addMarker(com.google.android.gms.maps.model.MarkerOptions)”上的空对象引用 - com.google.android.gms.maps.GoogleMap.addMarker(com.google.android.gms.maps.model.MarkerOptions)' on a null object reference 导入com.google.android.gms.maps无法解析 - import com.google.android.gms.maps cannot be resolved 尝试在空对象引用上调用虚拟方法&#39;void com.google.android.gms.maps.GoogleMap.setOnMapLongClickListener&#39; - Attempt to invoke virtual method 'void com.google.android.gms.maps.GoogleMap.setOnMapLongClickListener' on a null object reference 尝试调用虚拟方法&#39;void com.google.android.gms.maps.GoogleMap.setMyLocationEnabled(boolean) - Attempt to invoke virtual method 'void com.google.android.gms.maps.GoogleMap.setMyLocationEnabled(boolean)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM