我收到了这个错误: ERROR/MapActivity(258): Couldn't get connection factory client
一切都很好,突然之间,怎么会发生这种情况?我知道我的api键很好,因为一个月我一直在使用它.怎么突然它没有向我展示地图活动,并在logcat中发布错误?
我正在使用Android Studio 2.0 Beta2,我正在尝试运行使用google maps api v1(包com.google.android.maps)作为*.jar文件的旧项目.要运行这个旧项目,我需要指定比最后一个更早的compileSdkVersion(23).我用了
compileSdkVersion 'Google Inc.:Google APIs:17'
Run Code Online (Sandbox Code Playgroud)
但是我得到了错误:请在Android Studio中选择Android SDK错误.我如何使用较旧的compileSdkVersion运行这个旧项目?
在将我的Android SDK更新到版本22.0.1并更新Eclipse ADT之后,我发现我无法再在设备上安装调试版本.控制台显示此错误:
Installation error: INSTALL_PARSE_FAILED_NO_CERTIFICATES
Run Code Online (Sandbox Code Playgroud)
我发现我可以通过删除我的debug.keystore
文件并让SDK/ADT重新创建它来解决这个问题.这让我构建并安装一个调试包.
但是,该应用使用Google Maps v1 API,该API需要与签名绑定的API密钥debug.keystore
.重新创建debug.keystore
无效的API密钥,而Google 不再提供新的v1 API密钥.因此,当我运行调试版本时,地图视图为空白.
这不是一个showstopper,因为发布版本仍然可以正常工作.但有什么方法可以"修复"我的原始版本debug.keystore
,使其适用于ADT 22并匹配我的Maps v1 API密钥?
FWIW,这是输出keytool -list -v -keystore debug.keystore -storepass android
:
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: androiddebugkey
Creation date: Feb 20, 2012
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Android Debug, O=Android, C=US
Issuer: CN=Android Debug, O=Android, C=US
Serial number: 4f427735
Valid from: Mon Feb 20 …
Run Code Online (Sandbox Code Playgroud) 嗨,我想让我的地图放大到我当前的位置.当前通过向仿真器发送lat和long来定义当前位置.我该怎么做呢?
我目前的mapactivity.java
public class MapsActivity extends MapActivity {
private MapView mapView;
private MyLocationOverlay myLocOverlay;
MapController mc;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mapactivity);
initMap();
initMyLocation();
}
/**
* Initialise the map and adds the zoomcontrols to the LinearLayout.
*/
private void initMap() {
mapView = (MapView) findViewById(R.id.mapView);
View zoomView = mapView.getZoomControls();
LinearLayout myzoom = (LinearLayout) findViewById(R.id.zoom);
myzoom.addView(zoomView);
mapView.displayZoomControls(true);
mapView.getController().setZoom(17);
}
/**
* Initialises the MyLocationOverlay and adds it to the …
Run Code Online (Sandbox Code Playgroud) 我收到此错误:
E/Google Maps Android API: Authorization failure. Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
E/Google Maps Android API: In the Google Developer Console (https://console.developers.google.com)
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: [The key...]
Android Application (<cert_fingerprint>;<package_name>):
Run Code Online (Sandbox Code Playgroud)
这就是我所看到的,而不是地图正常工作:
在我的app/build.gradle
,我有这个:
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.8'
implementation 'com.google.android.gms:play-services-awareness:16.0.0'
implementation 'com.google.android.gms:play-services-cast:16.2.0'
implementation 'com.google.android.gms:play-services-gcm:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
Run Code Online (Sandbox Code Playgroud)
play-services-location
是我需要的谷歌地图,对吗?我正在查看https://developers.google.com/android/guides/setup上的列表,我认为这Google Location and Activity Recognition - com.google.android.gms:play-services-location:16.0.0
就是 …
google-maps google-maps-api-3 google-play-services google-maps-android-api-2 google-maps-android-api-1