地图程序:谷歌地图没有在我的应用程序中加载地图

关于地图程序的问题,在map app for android中经常遇到, 在我开始之前,我很新使用 java 我通常生产的应用程序是用 flash,但有人告诉我,eclipse 是更好的,所以我是一个初学者,当涉及到 eclipse 和 android。

在我开始之前,我很新使用 java 我通常生产的应用程序是用 flash,但有人告诉我,eclipse 是更好的,所以我是一个初学者,当涉及到 eclipse 和 android。

我正在尝试使用 Google 地图制作一个基本的导航风格应用程序。我遵循了无数的教程,并用 Google 搜索了几个小时来尝试解决我的问题,但我什么也没找到。

问题是地图没有加载它只是显示了一个灰色矩形网格。我自己看不到任何错误,但我没有去哪里看。我已经为我的证书和调试密钥库生成了谷歌地图的 API 密钥,因为这里有无数的教程和主题建议。Link 1

我用 SHA1 键这个方法。我已经尝试在模拟器调试这个,在设备上,导出 apk 文件,并直接安装到我的设备。

这是我的清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.route1designs.tenttom"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="17" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <uses-library android:name="com.google.android.maps"/>
        <activity
            android:name="com.route1designs.tenttom.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> 
        <activity android:label="mainmenu" android:name="MainMenu"></activity>  
        <activity android:label="settings" android:name="Settings"></activity> 
        <uses-library android:name="com.google.android.maps"/>
        <meta-data
    android:name="com.route1designs.tenttom.AIzaSyCAL-boLUdqDM_fLwlewYKNWHReXYVoEdU"
    android:value="AIzaSyCAL-boLUdqDM_fLwlewYKNWHReXYVoEdU"/>
    </application>
</manifest>

我的 mainMenu(地图活动):

package com.route1designs.tenttom;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogIntece;
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.route1designs.dbfunctions.DatabaseHandler;
import com.route1designs.dbfunctions.Location;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import  android.database.sqlite.SQLiteOpenHelper;
import java.util.List;
import org.w3c.dom.Text;
import android.util.Log;
import android.widget.TextView;
public class MainMenu extends MapActivity {
    //adds page vars for default page
    private MapView mapView;
    private MapController mc;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
            setContentView(R.layout.main_menu);
            mapView = (MapView) findViewById(R.id.start_map);
             mc = mapView.getController();
            String coordinates[] = {"30", "71"};
             double lat = Double.pDouble(coordinates[0]);
             double lng = Double.pDouble(coordinates[1]);
             GeoPoint p = new GeoPoint(
             (int) (lat * 1E6),
             (int) (lng * 1E6));
             mc.animateTo(p);
             mc.setZoom(7);
             mapView.invalidate();
            //build vars
            currentLocBG = findViewById(R.id.currentLoc);
            currentLoc = (TextView) findViewById(R.id.currentLocText);
    }
    @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);
        onMenuPressed();
        return true;
    }
    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }       
}

这是我的 XML 文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <com.google.android.maps.MapView
        android:id="@+id/start_map"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginTop="5p"
        android:clickable="true"
        android:enabled="true"
        android:orientation="vertical"
        android:apiKey="AIzaSyBp9PQhSJxHiJcRm6wETHbZr-eXcICanvI"/>
</RelativeLayout>

任何帮助将不胜感激,因为我完全卡住了。如果没有什么可以做的是更容易将谷歌地图纳入 Flash 专业或建设者。

0

您是在模拟器上运行还是在真实设备上运行?Google Maps API v2 不会在使用目标“Google API”创建的模拟器中运行,这是一个已知问题。有关解决方法,请参阅Running Google Maps v2 on the Android emulator

本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处

(86)
Jq添加css样式:使用 css添加字体样式(font style in css)
上一篇
Beauty box:在VisualStudioCode中向django-html文件添加格式化程序(美化程序 )
下一篇

相关推荐

  • html代码在线运行:My First HTML Page My First HTML Page

    HTML代码在线运行是指在网页上直接运行HTML代码,而不需要下载到本地电脑中再运行。它可以帮助开发者更快速地测试、调试和预览HTML代码,也可以作为教学工具。…

    2023-03-31 13:28:13
    0 35 22
  • css参考手册:标题

    CSS参考手册是一本关于CSS语言的参考书,由W3C组织出版,包含了CSS语言的完整语法、属性、值和案例等。它提供了一个完整的CSS语言参考,可以帮助开发者快速学习和使用CSS语言,从而更好地创建网页。…

    2023-06-29 01:40:51
    0 18 97
  • css登录界面模板代码:登录你的账号,开启新的旅程

    CSS登录界面模板代码是一种使用CSS来制作登录界面的代码,它可以帮助开发者快速制作出美观且易于使用的登录界面,以下是一个简单的CSS登录界面模板代码:…

    2023-05-06 06:17:54
    0 18 56
  • html5打地鼠游戏源码玩转你的反应能力!

    HTML5打地鼠游戏源码:…

    2024-03-28 03:35:42
    0 99 27
  • html 字体代码:😊 标题 😊

    示例示例HTML 字体代码是一种用于指定文本的字体样式的代码,可以用来更改文本的颜色、大小等。下面是一个示例:…

    2023-05-16 11:25:25
    0 17 68
  • html引用css文件:My Webpage Welcome to My Webpage!

    示例示例在html文件中引用css文件,可以使用标签,代码示例如下:其中,rel属性表示关系,type属性表示文件的类型,href属性表示css文件的路径。…

    2023-06-21 12:33:03
    0 71 78
  • css鼠标移入移出:标题

    CSS鼠标移入移出,可以使用CSS中的:hover伪类来实现,代码如下:上面的代码表示,当鼠标移入.example元素时,将其文字颜色改为白色。…

    2023-04-28 12:13:20
    0 14 51
  • css自动换行:标题

    CSS自动换行可以使用CSS的word-wrap属性来实现,代码如下:该属性有两个可选值:…

    2023-11-21 11:03:53
    0 99 63

发表评论

登录 后才能评论

评论列表(11条)