Eclipse Java Android-该应用程序赢得了';没有Google Play服务就无法运行
我看到了: 这看起来很相似,但对我的案子来说并没有解决。我已经导入了google play服务项目,并添加到了库中,但它仍然给了我这个错误 该链接的解决方案是改为GoogleAPI for emulator,但avd启动的时间太长,当我尝试运行我的应用程序时,需要很长时间 我想显示谷歌地图,因此我关注以下Youtube视频: 我已经做了以下工作来尝试让它工作: 1) 导入google-play-services_lib项目 2) 在SDK管理器中安装Google Play服务 3) 已创建具有正确SHA1的API_密钥 4) 仿真器目标:Android 4.4.2-API级别19 5) 当我使用cmd运行应用程序时,安装了com.android.vending-5.0.37-80300037-minAPI9.apk 6) 使用上述方法在我的模拟器中安装了Google Play Store应用程序 7) 在项目-->属性-->Android-->库-->中添加了对google-play-services_-lib项目的引用(添加了google-play-services_-lib项目) 8) 项目建设目标:标准安卓平台4.4.2 9) 在谷歌开发者控制台,我已经启用了谷歌地图Android API v2 MainActivity.javaEclipse Java Android-该应用程序赢得了';没有Google Play服务就无法运行,java,android,eclipse,google-maps,google-play-services,Java,Android,Eclipse,Google Maps,Google Play Services,我看到了: 这看起来很相似,但对我的案子来说并没有解决。我已经导入了google play服务项目,并添加到了库中,但它仍然给了我这个错误 该链接的解决方案是改为GoogleAPI for emulator,但avd启动的时间太长,当我尝试运行我的应用程序时,需要很长时间 我想显示谷歌地图,因此我关注以下Youtube视频: 我已经做了以下工作来尝试让它工作: 1) 导入google-play-services_lib项目 2) 在SDK管理器中安装Google Play服务 3) 已创建具有
package com.rachel.googlemaprouting;
public class MainActivity extends Activity {
private final LatLng LOCATION_SG = new LatLng(1.3499391,103.7492432);
private GoogleMap map;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
}
@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;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void onClick_Singapore(View v){
map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
CameraUpdate update = CameraUpdateFactory.newLatLngZoom(LOCATION_SG, 9);
map.animateCamera(update);
}
}
activity_main.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"
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="com.rachel.googlemaprouting.MainActivity" >
<!-- <Button
android:id="@+id/btnSingapore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:onClick="onClick_Singapore"
android:text="Singapore" />-->
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
在这个链接中,他们说我们不能在emulator上查看地图,但在Youtube视频中,Youtube可以
请帮助…您可能已经注意到,您应用程序中的谷歌地图需要手机安装谷歌播放服务。我认为在你的例子中,你的模拟器没有google play服务 以前你必须手动将它单独安装到模拟器上,但是谷歌在4.4.2之后才有了它 您现在需要做的就是下载并设置
模拟器目标:
到谷歌API(谷歌公司)-API级别19
,而不是安卓4.4.2-API级别19
请注意,emulator速度很慢,在您第一次运行应用程序时,可能需要几分钟才能开始渲染地图。(您将看到带有地图控制器的灰色屏幕)
即使emulator工作正常,在真实设备上测试应用程序始终是最好的,特别是当您使用google play服务时
希望有帮助。您使用的模拟器是哪个版本?@kaho Android 4.4.2-API级别19
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rachel.googlemaprouting"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="19" />
<permission
android:name="com.rachel.googlemaprouting.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.rachel.googlemaprouting.permission.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"/>
<!-- 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"/>
<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="[MY_API_KEY]"/> // i did fill this up with the api key i gotten.
<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" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
[2015-06-01 18:54:48 - MapRouting] ------------------------------
[2015-06-01 18:54:48 - MapRouting] Android Launch!
[2015-06-01 18:54:48 - MapRouting] adb is running normally.
[2015-06-01 18:54:48 - MapRouting] Performing com.rachel.googlemaprouting.MainActivity activity launch
[2015-06-01 18:54:48 - MapRouting] Automatic Target Mode: using existing emulator 'emulator-5556' running compatible AVD 'myAVD'
[2015-06-01 18:54:48 - MapRouting] Uploading MapRouting.apk onto device 'emulator-5556'
[2015-06-01 18:54:51 - MapRouting] Installing MapRouting.apk...
[2015-06-01 18:55:14 - MapRouting] Success!
[2015-06-01 18:55:14 - MapRouting] Starting activity com.rachel.googlemaprouting.MainActivity on device emulator-5556
[2015-06-01 18:55:17 - MapRouting] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.rachel.googlemaprouting/.MainActivity }