[英]This app won't run unless you update Google Play Services
I've been trying constantly now to get google maps for android V2 to work. 我一直在努力让Android V2的谷歌地图工作。 I'm trying this on device : Samsung Galaxy S [2.3.3] and on emulators.
我在设备上尝试这个:三星Galaxy S [2.3.3]和仿真器。
My manifest: (I've tried using both Debug key and Release key) 我的清单:(我尝试过使用Debug键和Release键)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.klottr"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="18" />
<permission
android:name="com.example.klottr.permission.MAPS_RECEIVE"
android:protectionLevel="signature"></permission>
<uses-permission
android:name="com.example.klottr.permission.MAPS_RECEIVE"/>
<uses-permission
android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission
android:name="android.permission.INTERNET"/>
<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-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="AIzaSyDqmCXjO-h-Yy_qGsyVrUz_icB9mCTUzLM"/>
<activity
android:name="com.example.klottr.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>
</manifest>
The mainactivity xml: 主要活动xml:
<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"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world" />
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
The mainactivity java file: mainactivity java文件:
package com.example.klottr;
import com.example.klottr.R;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class MainActivity extends FragmentActivity {
GoogleMap googleMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
I've tried following the guide on the google website, and several guides and tricks from stackoverflow. 我已经尝试按照谷歌网站上的指南,以及stackoverflow的一些指南和技巧。 I'd more than appreciate some tips.
我不仅仅是欣赏一些提示。 I'm just trying to get my device to show the map correctly at the moment, but instead I get "This app won't run unless you update Google Play Services" , Even though the latest version of Google Play Services is installed on my device.
我只是想让我的设备目前正确显示地图,但我得到“除非您更新Google Play服务,否则此应用无法运行”,即使我的Google Play服务上安装了最新版本的Google Play服务设备。
Google updated google_play_service library, but not the Play Services app in the google play. Google更新了google_play_service库,但没有更新Google Play中的Play服务应用。 So I suggest you to download "Google play services for Froyo" in the Android SDK Manager and plug it to the project instead of the current one.
因此,我建议您在Android SDK Manager中下载“Froyo的Google Play服务” ,并将其插入项目而不是当前项目。
Possible issue 1: READ_GSERVICES not present in manifest 可能的问题1:清单中不存在READ_GSERVICES
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
Link: http://t1685.codeinpro.us/q/51502052e8432c04261af736 链接: http : //t1685.codeinpro.us/q/51502052e8432c04261af736
Possible issue 2: This may just be the namespace of my app but in comparison it may be something to consider 可能的问题2:这可能只是我的应用程序的命名空间,但相比之下,它可能是需要考虑的事情
<permission android:name="com.fooapp.**androidmapsv2**.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission>
<uses-permission android:name="com.fooapp.**androidmapsv2**.permission.MAPS_RECEIVE" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
I just got it working on my laptop. 我刚刚在笔记本电脑上工作了。 The issue on my laptop was however only authorization failure.
然而,我的笔记本电脑上的问题只是授权失败。 Seems like my eclipse on the other pc was bugged or something.
好像我的eclipse在另一台电脑上被窃听或其他东西。 The code in the working project is almost exactly the same, with these exceptions:
工作项目中的代码几乎完全相同,但有以下例外:
In the manifest, these lines exist in the working project: 在清单中,这些行存在于工作项目中:
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
In MainActivity.java: 在MainActivity.java中:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*Test*/
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
And the only thing in my layout xml: 而我的布局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"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
Still have no idea why it didn't work from my previous code. 仍然不知道为什么它不能使用我以前的代码。 Note: Map is still blank on emulator, but works fine on Samsung Galaxy S 2.3.3 device
注意:地图在模拟器上仍为空白,但在Samsung Galaxy S 2.3.3设备上运行正常
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.