java - 不幸的是,(应用程序名称)已停止。 eclipse 显示 map

标签 java android eclipse

每次我在 AVD 中运行测试应用程序时都会显示。我试图显示 map ,Eclipse 没有显示任何错误。那么我该如何解决这个问题,如果 Eclipse 没有显示问题,我怎样才能找出问题所在呢?

(这是我的 MainActivity 的副本)

    package com.example.test;

import android.app.Activity;  
import android.support.v4.app.FragmentActivity; 
import android.os.Bundle;


public class MainActivity extends FragmentActivity {

    @Override  
    protected void onCreate(Bundle arg0) {  
         // TODO Auto-generated method stub  
         super.onCreate(arg0);  
         setContentView(R.layout.activity_main);  
    }  
}  

(这是我的 Activity_main.xml 的副本)

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"  
   android:layout_width="match_parent"  
   android:layout_height="match_parent"  
   tools:context=".MainActivity" >  
   <fragment  
     android:id="@+id/fragment1"  
     android:layout_width="match_parent"  
     android:layout_height="match_parent"  
     class="com.google.android.gms.maps.SupportMapFragment" />    

</RelativeLayout>

(这是我的 TestManifest 的副本)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.test"
     android:versionCode="1"  
   android:versionName="1.0" >  
   <uses-sdk  
     android:minSdkVersion="8"  
     android:targetSdkVersion="14" />  
   <uses-permission android:name="android.permission.INTERNET" />  
   <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />  
   <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />  
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />  
   <uses-permission android:name="com.djandroid.mapsv2.permission.MAPS_RECEIVE" />  
   <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />  
   <uses-feature  
     android:glEsVersion="0x00020000"  
     android:required="true" />  
   <application  
     android:allowBackup="true"  
     android:icon="@drawable/ic_launcher"  
     android:label="@string/app_name"  
     android:theme="@style/AppTheme" >  
     <activity  
       android:name="com.example.test.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>  
     <meta-data  
       android:name="com.example.test..API_KEY"  
       android:value="AIzaSyBQ1sjxD09jxrSff68ZP77JpLQxm9LB8Hs" />  
     <uses-library  
       android:name="com.google.android.maps"  
       android:required="true" />  
   </application>  
</manifest>

请帮助我

最佳答案

在 list 文件中

 <!-- Google API Key -->
<meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="YOURAPIKEY" />
<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

关于java - 不幸的是,(应用程序名称)已停止。 eclipse 显示 map ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23764324/

相关文章:

java - java读取txt文件中的分数

android - 如何获取 Android 内部应用程序共享 key SHA1 以启用 Google API?

android - 如何在 ADT 的图形布局编辑器中调试自定义 View

java - 为什么长期使用后建议更换jdk?

java - 无法打印从txt文件读取的数组

java - 如何在 Android Studio 中正确创建从 AAR 导入的 Android 库模块?

java - 从 wsdl 到客户端 java web 服务(服务器有自签名证书)

android - 在没有 Gradle 的情况下使用 multiDexEnabled,而是使用 Eclipse 构建过程

java - 如何删除 Eclipse 提供的默认命令行参数?

android - Android 标题中奇怪的连字符