Google Map Android v2的申请key加导入google-play-services_lib方法 new!


1.申请key



2.用



这个来输入


加到后面

3.再按照


要求来进行填写。结果就得到key了

得到key后操作

1、要求 skd 和 工作目录 要在同一磁盘分区

2、要求 api key  对应的工作包 



3、打开sdk manager 在extras中安装
   android support library
   google play services
   google market billing
   google market licensing
4、引入google-play-services_lib项目到myeclipse
   file-import-android-existing android code into workspace
   浏览到sdk项目对应的目录
   例如:
E:\android-sdk-windows\extras\google\google_play_services\libproject\google-play-services_lib


5、新建项目 选择带有google api的sdk
6、在新建项目的manifest中 加入
   是application的子标签
   1、<meta-data android:name="com.google.android.maps.v2.API_KEY"  android:value="自己的apikey"/> 
  2 、在mainifest跟标签下
  <uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- The following two permissions are not required to use
    Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>




 <!-- opengl es -->
<uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>




7、打开activity_main.xml
清空里面的内容
填入
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/map"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
           class="com.google.android.gms.maps.SupportMapFragment"/>
8、打开Activity
  修改继承
MainActivity extends FragmentActivity 


9、引入google-play-services_lib:
   右击自己的项目 选择 proprties->左侧 选择android 在右侧library一栏 点击add 浏览到google-play-services_lib
这个项目 点击apply 注意:不要勾选is library


10、运行项目前 必须在机器上安装 google play services ,google play store 

   

猜你喜欢

转载自blog.csdn.net/kzeler1/article/details/9772025
今日推荐