Android 在实际设备上运行谷歌地图
我尝试在实际设备中运行google map,该设备具有android版本4.0.3 ICE sandwitch,我阅读了许多教程,每个设置都可以,如: 在SDK管理器中安装google play服务。 在我的应用程序中导入google play服务库。 获取谷歌地图API密钥 清单文件代码如下所示:Android 在实际设备上运行谷歌地图,android,google-maps,Android,Google Maps,我尝试在实际设备中运行google map,该设备具有android版本4.0.3 ICE sandwitch,我阅读了许多教程,每个设置都可以,如: 在SDK管理器中安装google play服务。 在我的应用程序中导入google play服务库。 获取谷歌地图API密钥 清单文件代码如下所示: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.google_map_application"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="15" />
<permission
android:name="com.example.google_map_application.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.google_map_application.MAPS_RECEIVE" />
<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" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCoIsr6NxAH_J3NLtkh5YSxQGZAq1gvWW8" />
<activity
android:name="com.example.google_map_application.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
}
此错误持续出现:
java.lang.RuntimeException:无法启动活动组件信息{com.example.google\u map\u application/com.example.google\u map\u application.MainActivity}:android.view.InflateException:二进制XML文件行#16:膨胀类片段时出错。尝试将目标SDK更改为与您的Google Play服务库版本类似的内容,例如:
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="17" />
尝试将目标SDK更改为与您的Google Play服务库版本类似的版本,例如:
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="17" />
将android:targetSdkVersion与您下载的相同版本的api匹配,例如,如果您下载了google api 17,则将其更改为17。将android:targetSdkVersion与您下载的相同版本的api匹配,例如,如果您已下载google api 17,请将其更改为17。可能与我读到的内容重复,这还不够,错误仍然存在。!!可能您错过了它,它清楚地说明您应该使用FragmentActivity
而不是Activity
。我将它更改为FragmentActivity,但仍然无法工作!!可能重复我读过它,这是不够的,错误仍然存在。!!可能您错过了它,它清楚地说明您应该使用FragmentActivity
而不是Activity
。我将它更改为FragmentActivity,但仍然无法工作!!这对我来说是正确的。错误是在导入Google_play_services_lib的bath时发生的。我认为它工作正常。错误是在导入Google_play_services_lib的bath时发生的。