SupportMapFragment有什么问题?

时间:2014-09-28 00:12:16

标签: android adt android-maps-v2 supportmapfragment mapfragment

我有ados x86-64 mac os。我从地图v2文档中做了所有事情,但我仍然得到:

09-28 03:07:11.755:E / AndroidRuntime(549):引起:android.app.Fragment $ InstantiationException:无法实例化片段com.google.android.gms.maps.SupportMapFragment:确保类名存在,是公共的,并且有一个公共的空构造函数 09-28 03:07:11.755:E / AndroidRuntime(549):在android.app.Fragment.instantiate(Fragment.java:597) 09-28 03:07:11.755:E / AndroidRuntime(549):在android.app.Fragment.instantiate(Fragment.java:561) 09-28 03:07:11.755:E / AndroidRuntime(549):在android.app.Activity.onCreateView(Activity.java:4778) 09-28 03:07:11.755:E / AndroidRuntime(549):在android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689) 09-28 03:07:11.755:E / AndroidRuntime(549):... 20多个 09-28 03:07:11.755:E / AndroidRuntime(549):引起:java.lang.ClassNotFoundException:未找到类" com.google.android.gms.maps.SupportMapFragment" on path:DexPathList [[zip file" /data/app/com.example.service.ro-2.apk"],nativeLibraryDirectories = [/ data / app-lib / com.example.service.ro -2,/ vendor / lib,/ system / lib]] 09-28 03:07:11.755:E / AndroidRuntime(549):at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) 09-28 03:07:11.755:E / AndroidRuntime(549):at java.lang.ClassLoader.loadClass(ClassLoader.java:497) 09-28 03:07:11.755:E / AndroidRuntime(549):at java.lang.ClassLoader.loadClass(ClassLoader.java:457) 09-28 03:07:11.755:E / AndroidRuntime(549):在android.app.Fragment.instantiate(Fragment.java:583) 09-28 03:07:11.755:E / AndroidRuntime(549):... 23更多

我的AndroidManifest看起来像这样:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.service.ro"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="19" />

     <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <permission
        android:name="com.example.service.ro.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.example.service.ro.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <uses-permission android:name="android.permission.WRITE_CONTACTS" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/CustomActionBarTheme" >

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <activity
            android:name="homeview.DetailActivity"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="homeview.Start"
            android:screenOrientation="portrait" >
        </activity>



        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="******************************" />




    </application>

</manifest>

这是布局:

<?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"
          android:name="com.google.android.gms.maps.SupportMapFragment"/>

由于

1 个答案:

答案 0 :(得分:1)

我终于成功了。

从java构建路径Libraries选项卡中删除android依赖项。 应该只有:

Android 4.xx Android私人图书馆