当前状态:问题尚未解决 - 需要帮助..
我现在使用新的谷歌地图 Android v2 开发地图应用程序..在我将它应用到我的真实应用程序之前..我做了一个测试..并试图让它工作..我遵循了Google Developers的文档
但似乎有些部分我错过了,但找不到它们.. 你能帮我识别它们吗?我会在下面给你我的源代码......让你清楚地看到它们......
这是我当前的 MainActivity 类(更新):<---我的程序中只有这个类
package com.madcatworld.demomapv2;
import com.google.android.gms.maps.SupportMapFragment;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SupportMapFragment fragment = new SupportMapFragment();
getSupportFragmentManager().beginTransaction()
.add(R.id.map, fragment).commit();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
这是我的activity_main.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"
class="com.google.android.gms.maps.SupportMapFragment" />
这是我的 Manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.madcatworld.demomapv2"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="14" />
<permission
android:name="com.madcatworld.demomapv2.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.madcatworld.demomapv2.permission.MAPS_RECEIVE" />
<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-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<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="xxxxxxxxxxxxxxx" />
<activity
android:name="com.madcatworld.demomapv2.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>
我的模拟器:出现“获取 Google Play 服务”对话框..当我点击它时...出现如下一些错误..
我当前的错误日志(更新)它似乎比以前的错误更短!:) :
01-25 04:23:18.647: E/AndroidRuntime(503): FATAL EXCEPTION: main
01-25 04:23:18.647: E/AndroidRuntime(503): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=http://play.google.com/store/apps/details?id=com.google.android.gms flg=0x80000 pkg=com.android.vending }
01-25 04:23:18.647: E/AndroidRuntime(503): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
01-25 04:23:18.647: E/AndroidRuntime(503): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
01-25 04:23:18.647: E/AndroidRuntime(503): at android.app.Activity.startActivityForResult(Activity.java:2817)
01-25 04:23:18.647: E/AndroidRuntime(503): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
01-25 04:23:18.647: E/AndroidRuntime(503): at android.app.Activity.startActivity(Activity.java:2923)
01-25 04:23:18.647: E/AndroidRuntime(503): at com.google.android.gms.internal.d$2.onClick(Unknown Source)
01-25 04:23:18.647: E/AndroidRuntime(503): at android.view.View.performClick(View.java:2408)
01-25 04:23:18.647: E/AndroidRuntime(503): at android.view.View$PerformClick.run(View.java:8816)
01-25 04:23:18.647: E/AndroidRuntime(503): at android.os.Handler.handleCallback(Handler.java:587)
01-25 04:23:18.647: E/AndroidRuntime(503): at android.os.Handler.dispatchMessage(Handler.java:92)
01-25 04:23:18.647: E/AndroidRuntime(503): at android.os.Looper.loop(Looper.java:123)
01-25 04:23:18.647: E/AndroidRuntime(503): at android.app.ActivityThread.main(ActivityThread.java:4627)
01-25 04:23:18.647: E/AndroidRuntime(503): at java.lang.reflect.Method.invokeNative(Native Method)
01-25 04:23:18.647: E/AndroidRuntime(503): at java.lang.reflect.Method.invoke(Method.java:521)
01-25 04:23:18.647: E/AndroidRuntime(503): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-25 04:23:18.647: E/AndroidRuntime(503): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-25 04:23:18.647: E/AndroidRuntime(503): at dalvik.system.NativeStart.main(Native Method)
供你参考,
我已经通过从 Eclipse 复制我的 SHAI 号码在我的谷歌帐户中生成了一个新的 api 密钥。
我做了这个步骤Android工具>右键单击>导出签名的应用程序包(使它们相互链接,我创建新的密钥库)我的问题是:我应该实现这个(否2)?
如果您发现我犯的任何错误,请告诉我..谢谢