V2片段地图缩放控制

V2片段地图缩放控制

本文介绍了空白地图上使用谷歌地图的API V2片段地图缩放控制:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我特林实现使用新的谷歌地图API V2谷歌地图和出于某种原因,我没有看到一张地图。

我觉得这个问题是错误的那两行,当我在模拟器上运行它:

  E / ActivityThread(1373年):未能找到com.google.settings供应商信息
 E / ActivityThread(1373年):未能找到com.google.android.gsf供应商信息
.gservices

当我运行设备产生以下错误上的应用:

 找不到类的maps.j.k,从法map.y.ae.a引用

我的问题看起来与在此链接:

有它说,该问题可能是我的钥匙,所以我就去使用下面的教程复制它:的.但是这仍然没有帮助我。

支持文件当然是添加到项目中,以及在谷歌发挥服务库。
我看到在模拟器上相同的结果(手动添加两个文件,​​允许使用模拟器上的谷歌地图V2之后),以及对摩托罗拉Defy运行Android 2.2。

也许我用错了debug.keystore?我使用一个在我User.android folder.If所以后来我如何找到正确的文件?

编辑:我的日食说我调试键在默认的文件夹。所以我改名为debug.keystore文件并运行Eclipse来一遍重新创建它。这导致产生一个新的SHA1密钥。我用它来创建一个新的谷歌地图API V2关键,但结果还是一样。我仍然无法看到的地图。

EDIT2:愚蠢的我,我选择的,而不是谷歌地图Android版API V2谷歌地图API V2。
       这个问题可以被关闭。谢谢你。

下面都是code文件:

XML:

 <?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:方向=垂直>
 <片段
    的xmlns:地图=htt​​p://schemas.android.com/apk/res-auto
    机器人:ID =@ + ID /图
    机器人:名字=com.google.android.gms.maps.SupportMapFragment
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    图:cameraBearing =112.5
    图:cameraTargetLat = - 33.796923
    图:cameraTargetLng =150.922433
    图:cameraTilt =30
    图:cameraZoom =13
    图:地图类型=正常
    图:uiCompass =假
    图:uiRotateGestures =真
    图:uiScrollGestures =假
    图:uiTiltGestures =真
    图:uiZoomGestures =真/>
< / LinearLayout中>

地图Fragmentactivity类:

 包com.eadesign.skygiraffefinalv2;
进口com.google.android.gms.common.GooglePlayServicesUtil;
进口com.google.android.gms.maps.GoogleMap;
进口android.os.Bundle;
进口com.google.android.gms.maps *。
进口android.widget.ImageView;
进口android.widget.TextView;
公共类地图扩展android.support.v4.app.FragmentActivity
{
私人GoogleMap的地图;
@覆盖
保护无效的onCreate(捆绑savedInstanceState)
{
        super.onCreate(savedInstanceState);
        的setContentView(R.layout.map);        如果(GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext())== 0)
        {
            地图=((SupportMapFragment)getSupportFragmentManager()findFragmentById(R.id.map)。)的GetMap();
        // map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
        }
}}

清单文件:

 <?XML版本=1.0编码=UTF-8&GT?;
<清单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
包=com.eadesign.skygiraffefinalv2
安卓版code =1
机器人:=的versionName1.0>
<采用-SDK安卓的minSdkVersion =8机器人:targetSdkVersion =17/>
<允许机器人:名字=com.eadesign.skygiraffefinalv2.permission.MAPS_RECEIVE安卓的ProtectionLevel =签名/>
<使用许可权的android:NAME =com.eadesign.skygiraffefinalv2.permission.MAPS_RECEIVE/>
<使用许可权的android:NAME =android.permission.INTERNET对/>
<使用许可权的android:NAME =android.permission.WRITE_EXTERNAL_STORAG​​E/>
<使用许可权的android:NAME =com.google.android.providers.gsf.permission.READ_GSERVICES/>
<使用许可权的android:NAME =android.permission.ACCESS_COARSE_LOCATION/>
<使用许可权的android:NAME =android.permission.ACCESS_FINE_LOCATION/><用途特征
  机器人:glEsVersion =0x00020000
  机器人:要求=真/><应用
    机器人:allowBackup =真
    机器人:图标=@绘制/ sgicon90
    机器人:标签=@字符串/ APP_NAME
    机器人:主题=@安卓风格/ Theme.Black.NoTitleBar.Fullscreen>
    <活动
        机器人:地图NAME =
        机器人:标签=@字符串/ APP_NAME>
         &所述;意图滤光器>
            <作用机器人:名字=android.intent.action.MAIN/>
            <类机器人:名字=android.intent.category.LAUNCHER/>
        &所述; /意图滤光器>
    < /活性GT;    &所述;元数据
        机器人:名字=com.google.android.maps.v2.API_KEY
        机器人:值=我的钥匙/>
< /用途>

日志从logcat的:

  ent.category.LAUNCHER] FLG = 0x10000000的CMP = com.eadesign.skygiraffefinalv2 / .MAP U =
0}从PID 1362
W /窗口管理器(148):未能采取截图为(246x410)到层21010
D / AndroidRuntime(1362):关闭VM
I / ActivityManager(148):开始的活动PROC com.eadesign.skygiraffefinalv2
com.eadesign.skygiraffefinalv2 / .MAP:PID = 1373 UID = 10046导报= {3003 1015 1028}
D / dalvikvm(1373年):不晚启用CheckJNI(已上)
D / dalvikvm(1362):GC_CONCURRENT释放99K,77%免费483K / 2048K,暂停1毫秒+ 1毫秒,
共有13毫秒
D / JDWP(1362):GOT唤醒信号,选择的拯救
D / dalvikvm(1362):调试器脱落;对象注册了1项
E / JDWP(1373年):无法发送回复调试器:断的管
D / dalvikvm(1373年):调试器分离;对象注册了2项
E /跟踪(1373年):错误打开跟踪文件:没有这样的文件或目录(2)
D / dalvikvm(1373年):GC_CONCURRENT释放204K,3%的自由8264K / 8519K,暂停89ms +6米
s,共计161ms
D / dalvikvm(1373年):WAIT_FOR_CONCURRENT_GC受阻为33ms
E / ActivityThread(1373年):未能找到com.google.settings供应商信息
E / ActivityThread(1373年):未能找到com.google.settings供应商信息
D / dalvikvm(1373年):GC_CONCURRENT释放312K,5%的游离8471K / 8839K,暂停82MS + 10
5ms的,总268ms
E / ActivityThread(1373年):未能找到com.google.android.gsf供应商信息
.gservices
E / ActivityThread(1373年):未能找到com.google.android.gsf供应商信息
.gservices
D / dalvikvm(1373年):GC_CONCURRENT释放227K,4%免​​费8797K / 9095K,暂停91ms + 11
0毫秒,总300毫秒
D / libEGL(1373年):无仿真检测GPU的支持。回退到软件研发
enderer。
I /编舞(1373年):跳过54帧!该应用程序可能会做太睦
其主线程^ h的工作。
D / gralloc_goldfish(1373年):无仿真模拟GPU检测。
D / libEGL(1373年):加载/system/lib/egl/libGLES_android.so
I / ActivityManager(148):显示com.eadesign.skygiraffefinalv2 / .MAP:+ 3s545ms
I /编舞(1373年):跳过75帧!该应用程序可能会做太睦
 其主线程^ h的工作。


解决方案

在我的情况,我选择的谷歌地图 API V2,而不是谷歌地图Android版 API V2。改变这个问题走后。所以这code是完全没有创建一个全屏谷歌地图和问题都可以关闭。

感谢。

I am tring to implement google maps using the new google maps api v2 and for some reason i don't see a map.

I think that the problem is those two lines of error when i run it on the emulator:

 E/ActivityThread( 1373): Failed to find provider info for com.google.settings
 E/ActivityThread( 1373): Failed to find provider info for com.google.android.gsf
.gservices

when i run the application on the device the following error is produced:

Could not find class 'maps.j.k', referenced from method map.y.ae.a

My problem looks the same as in this link: http://android-er.blogspot.co.il/2012/12/google-maps-android-api-v2-with-blank.html

There it's says that the problem may be my key so i went and reproduced it using the following tutorial: http://android-er.blogspot.co.il/2012/12/displaying-sha1-certificate-fingerprint.html. but this still didn't helped me.

the support files are of course add to the project as well as the Google play services lib.I see the same result on the emulator (after adding manually the two file that allow using the google map v2 on the emulator) as well as on the motorola Defy running android 2.2.

Maybe I am using the wrong debug.keystore? I am using the one in my User.android folder.If so then how do i find the right file?

EDIT: My eclipse says that my debug key is in the default folder. So i renamed the debug.keystore file and ran the Eclipse to recreate it all over again. That resulted in producing a new SHA1 key. I used it to create a new Google Maps API v2 key but the result is still the same. I'm still unable to see the map.

EDIT2: Stupid me, I chose Google Map API V2 instead of Google Maps Android API V2. This question can be closed. Thanks.

Here are all the code files:

xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
 <fragment
    xmlns:map="http://schemas.android.com/apk/res-auto"
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    map:cameraBearing="112.5"
    map:cameraTargetLat="-33.796923"
    map:cameraTargetLng="150.922433"
    map:cameraTilt="30"
    map:cameraZoom="13"
    map:mapType="normal"
    map:uiCompass="false"
    map:uiRotateGestures="true"
    map:uiScrollGestures="false"
    map:uiTiltGestures="true"
    map:uiZoomGestures="true" />
</LinearLayout>

Map Fragmentactivity class:

package com.eadesign.skygiraffefinalv2;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.GoogleMap;
import android.os.Bundle;
import com.google.android.gms.maps.*;
import android.widget.ImageView;
import android.widget.TextView;
public class Map extends android.support.v4.app.FragmentActivity
{
private GoogleMap map;


@Override
protected void onCreate(Bundle savedInstanceState)
{
        super.onCreate(savedInstanceState);
        setContentView(R.layout.map);

        if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()) == 0)
        {
            map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
        //  map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
        }
}}

manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.eadesign.skygiraffefinalv2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8"  android:targetSdkVersion="17"/>
<permission android:name="com.eadesign.skygiraffefinalv2.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.eadesign.skygiraffefinalv2.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<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/sgicon90"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">


    <activity
        android:name=".Map"
        android:label="@string/app_name">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="My key"/>
</application>

log from logcat:

ent.category.LAUNCHER] flg=0x10000000 cmp=com.eadesign.skygiraffefinalv2/.Map u=
0} from pid 1362
W/WindowManager(  148): Failure taking screenshot for (246x410) to layer 21010
D/AndroidRuntime( 1362): Shutting down VM
I/ActivityManager(  148): Start proc com.eadesign.skygiraffefinalv2 for activity
com.eadesign.skygiraffefinalv2/.Map: pid=1373 uid=10046 gids={3003, 1015, 1028}
D/dalvikvm( 1373): Not late-enabling CheckJNI (already on)
D/dalvikvm( 1362): GC_CONCURRENT freed 99K, 77% free 483K/2048K, paused 1ms+1ms,
total 13ms
D/jdwp    ( 1362): Got wake-up signal, bailing out of select
D/dalvikvm( 1362): Debugger has detached; object registry had 1 entries
E/jdwp    ( 1373): Failed sending reply to debugger: Broken pipe
D/dalvikvm( 1373): Debugger has detached; object registry had 2 entries
E/Trace   ( 1373): error opening trace file: No such file or directory (2)
D/dalvikvm( 1373): GC_CONCURRENT freed 204K, 3% free 8264K/8519K, paused 89ms+6m
s, total 161ms
D/dalvikvm( 1373): WAIT_FOR_CONCURRENT_GC blocked 33ms
E/ActivityThread( 1373): Failed to find provider info for com.google.settings
E/ActivityThread( 1373): Failed to find provider info for com.google.settings
D/dalvikvm( 1373): GC_CONCURRENT freed 312K, 5% free 8471K/8839K, paused 82ms+10
5ms, total 268ms
E/ActivityThread( 1373): Failed to find provider info for com.google.android.gsf
.gservices
E/ActivityThread( 1373): Failed to find provider info for com.google.android.gsf
.gservices
D/dalvikvm( 1373): GC_CONCURRENT freed 227K, 4% free 8797K/9095K, paused 91ms+11
0ms, total 300ms
D/libEGL  ( 1373): Emulator without GPU support detected. Fallback to software r
enderer.
I/Choreographer( 1373): Skipped 54 frames!  The application may be doing too muc
h work on its main thread.
D/gralloc_goldfish( 1373): Emulator without GPU emulation detected.
D/libEGL  ( 1373): loaded /system/lib/egl/libGLES_android.so
I/ActivityManager(  148): Displayed com.eadesign.skygiraffefinalv2/.Map: +3s545ms
I/Choreographer( 1373): Skipped 75 frames!  The application may be doing too muc
 h work on its main thread.
解决方案

In my case I chose Google Maps API V2 instead of Google Maps Android API V2. After changing that the problem was gone. So this code is perfectly fine to create a full screen Google map and the question can be closed.

Thanks.

这篇关于空白地图上使用谷歌地图的API V2片段地图缩放控制:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 22:40