我有一个 facebook 风格的侧边栏导航视图。在主视图上,我想显示我的地图。我完全按照谷歌的教程!但我一直遇到错误无法实例化 android.gms.maps.SupportMapFragment。
我确实设法在一个普通项目上运行它,但是当我将它与我的主项目合并时,会弹出这个错误:
07-25 13:27:53.778: E/AndroidRuntime(24841): 
Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment:
make sure class name exists, is public, and has an empty constructor that is public
我尝试了下面发布的答案,但问题仍然存在。
还有这个:
谷歌地图 V2 中的错误 java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment
还设置了项目属性中对 google sdk 的引用。这是课程:
    public class SlideAnimationThenCallLayout extends FragmentActivity implements AnimationListener {
View menu;
View app;
boolean menuOut = false;
AnimParams animParams = new AnimParams();
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_slide_animation_then_call_layout);
    LinearLayout linearLayout = (LinearLayout) findViewById(R.id.menu);
    linearLayout.setOnTouchListener(new OnSwipeTouchListener(){
        public void onSwipeRight() {
            swipeAnimation();
        }
    });
    RelativeLayout listview3 = (RelativeLayout) findViewById(R.id.relativeLayout1);
    listview3.setOnTouchListener(new OnSwipeTouchListener(){
        public void onSwipeRight() {
            swipeAnimation();
        }
        public void onSwipeLeft() {
            swipeAnimation();
        }
    });
    menu = findViewById(R.id.menu);
    app = findViewById(R.id.relativeLayout1);
}
xml文件是:
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/frame_layout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
    android:id="@+id/menu"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <ListView
        android:id="@+id/listView3"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:background="@drawable/action_eating">
    </ListView>
</LinearLayout>
<RelativeLayout
    android:id="@+id/relativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/android_homescreen">
    <fragment
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>
我不知道现在这里出了什么问题。任何帮助将不胜感激。