2012-01-31 259 views
0

我试图从Android 4.0.3教程中运行HelloGoogleMaps应用程序。HelloGoogleMap运行时崩溃

我得到这个从控制台,一切似乎都很正常,直到:

Uploading HelloGoogleMaps.apk onto device 'emulator-5554' 
[2012-01-31 16:05:29 - HelloGoogleMaps] Installing HelloGoogleMaps.apk... 
[2012-01-31 16:05:45 - HelloGoogleMaps] Success! 
[2012-01-31 16:05:46 - HelloGoogleMaps] Starting activity  net.examples.HelloGoogleMaps.HelloGoogleMapsActivity on device emulator-5554 
[2012-01-31 16:05:48 - HelloGoogleMaps] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=net.examples.HelloGoogleMaps/.HelloGoogleMapsActivity } 

在这一点上,仿真器显示“很抱歉,您的应用程序没有跑......”,并在logcat中,我看到这个:

01-31 15:56:50.702: E/AndroidRuntime(649): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871) 

任何帮助将不胜感激。我也清理了一下,关闭了并重新开放了这个项目,但无济于事。

+0

请在你的Manifest文件中看到。 您是否定义了第二个活动(MapActivity) – NovusMobile 2012-02-01 12:36:29

+0

是的,在我的Manifest文件中的Application中,我有一个具有定义名称的“HelloGoogleActivity”活动。 – user1174708 2012-02-01 17:25:29

+0

确保您已在应用程序标签内添加了用户库 – 2012-02-02 05:14:41

回答

0

你有你的延伸活动,以延长MapActivity {

给予适当的权限到manifest文件:

<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.INTERNET" /> 
<activity android:name=".HelloGoogleMaps" android:label="@string/app_name" 
android:theme="@android:style/Theme.NoTitleBar"> 

您的main.xml

<?xml version="1.0" encoding="utf-8"?> 
<com.google.android.maps.MapView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/mapview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:clickable="true" 
    android:apiKey="Your Maps API Key goes here" 
/> 

我觉得有问题。 如果你想要更多请分享你的代码...

+0

您是否为此获得了解决方案? – NovusMobile 2012-02-09 04:51:15