我是android开发的新手,我正在尝试创建一个地图应用程序但是甚至无法在片段上显示简单的地图。
我跟着很多&很多教程,在stackoverflow中搜索了很多答案,但仍然无法得到我想要的结果。
我正在eclipse中开发并在模拟器中运行应用程序,我创建了一个模拟器列表来测试它们,但是没有人可以向我展示Map片段。
我现在拥有的当前AVD是:
所有theese 3都没有谷歌播放服务,甚至无法安装它们(我看过的教程没有用)。
我可以安装谷歌播放服务的最后一个AVD是带有ARM v7图像系统的NEXUS S API 17 ,我的谷歌播放服务 12-5-18-000300-188802357 工作正常,我已经安装了googleFrameWork和谷歌游戏商店(即使更新它也会一直崩溃)
我后来得到的连续消息是“Google Play服务正在更新”,每当我尝试更新Google Play服务时,应用程序崩溃并立即停止。
这是我的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.algerlasmart"
android:versionCode="1"
android:versionName="1.0" >
<permission android:name="com.exemple.algerlasmart.permission.MAPS_RECEIVE"
android:protectionLevel="signature">
</permission>
<uses-permission android:name="android.permission.ACESS_NETWOK_STATE"/>
<uses-permission
android:name="com.exemple.algerlasmart.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.READ_LOGS"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission
android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="27" />
<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"
android:name="android.support.multidex.MultiDexApplication"
>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBBu2eJ-fSdlwUI9dPJhlbxK0emspboplQ"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainInterface"
android:label="@string/dashboard"
android:configChanges="orientation|screenSize">
</activity>
<activity
android:name=".GetContact"
android:label="@string/dashboard"
android:configChanges="orientation|screenSize">
</activity>
<activity
android:name="com.exemple.fragments.Dummy"
android:label="@string/dashboard"
android:configChanges="orientation|screenSize">
<intent-filter >
<action android:name="com.exemple.fragments.Dummy"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
我使用过的Google Play服务库是用于API 22的lib(没有工作),我降级到lib r18(来自google的repôsitories的旧版)。
我的地图的XML文件如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/arroundMeLay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/libele"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<fragment
style="@style/mapViewStyle"
android:layout_width="match_parent"
android:layout_height="200dp"
class="com.google.android.gms.maps.MapFragment" >
</fragment>
</LinearLayout>
请我花一个多月时间坚持这些问题。
注意:我每次都尝试更新,升级,降级SDK,但仍然没有答案或解决方案适用于我。