Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 不幸的是,当试图集成谷歌地图时,该项目已经停止_Android - Fatal编程技术网

Android 不幸的是,当试图集成谷歌地图时,该项目已经停止

Android 不幸的是,当试图集成谷歌地图时,该项目已经停止,android,Android,我正在尝试将谷歌地图集成到我的应用程序中。收到API密钥,粘贴它,安装Google Play服务,apk文件,权限也可以。正在尝试编译。代码看起来类似于教程中的那个代码,比如manifest。但我收到“不幸的是,项目已经停止”。 我已经尝试了很多教程-没有任何帮助。这是一个代码: cont.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schema

我正在尝试将谷歌地图集成到我的应用程序中。收到API密钥,粘贴它,安装Google Play服务,apk文件,权限也可以。正在尝试编译。代码看起来类似于教程中的那个代码,比如manifest。但我收到“不幸的是,项目已经停止”。 我已经尝试了很多教程-没有任何帮助。这是一个代码:

cont.xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <Button
        android:id="@+id/cont_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:text="Contacts"
        android:textSize="14dp" />

    <Button
        android:id="@+id/n_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:text="News"
        android:textSize="14dp" />

    <Button
        android:id="@+id/about_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:text="About"
        android:textSize="14dp" />

    <Button
        android:id="@+id/help_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_toRightOf="@+id/about_1"
        android:text="Help"
        android:textSize="14dp" />

    <Button
        android:id="@+id/info_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:text="Info"
        android:textSize="14dp" />

    <Button
        android:id="@+id/don_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_toRightOf="@+id/about_1"
        android:text="Donate"
        android:textSize="14dp" />

    <Button
        android:id="@+id/zkt_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_marginLeft="25dp"
        android:layout_toRightOf="@+id/help_1"
        android:text="Calculate"
        android:textSize="14dp" />

    <WebView
        android:id="@+id/web"
        android:layout_width="wrap_content"
        android:layout_height="200dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/about_1" />

    <fragment 
        android:id="@+id/fr"
        android:layout_width="wrap_content"
        android:layout_height="200dp"
        />

</RelativeLayout>
日志:

    04-28 01:22:41.928: W/EGL_genymotion(2203): eglSurfaceAttrib not implemented
04-28 01:22:47.028: W/EGL_genymotion(2203): eglSurfaceAttrib not implemented
04-28 01:22:49.188: W/EGL_genymotion(2203): eglSurfaceAttrib not implemented
04-28 01:22:50.924: D/AndroidRuntime(2203): Shutting down VM
04-28 01:22:50.924: W/dalvikvm(2203): threadid=1: thread exiting with uncaught exception (group=0xa4b87648)
04-28 01:22:50.928: E/AndroidRuntime(2203): FATAL EXCEPTION: main
04-28 01:22:50.928: E/AndroidRuntime(2203): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sadaka/com.example.sadaka.Cont}: android.view.InflateException: Binary XML file line #78: Error inflating class fragment
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.os.Looper.loop(Looper.java:137)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.app.ActivityThread.main(ActivityThread.java:5103)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at java.lang.reflect.Method.invokeNative(Native Method)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at java.lang.reflect.Method.invoke(Method.java:525)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at dalvik.system.NativeStart.main(Native Method)
04-28 01:22:50.928: E/AndroidRuntime(2203): Caused by: android.view.InflateException: Binary XML file line #78: Error inflating class fragment
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.app.Activity.setContentView(Activity.java:1895)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at com.example.sadaka.Cont.onCreate(Cont.java:24)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.app.Activity.performCreate(Activity.java:5133)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
04-28 01:22:50.928: E/AndroidRuntime(2203):     ... 11 more
04-28 01:22:50.928: E/AndroidRuntime(2203): Caused by: java.lang.NullPointerException: name == null
04-28 01:22:50.928: E/AndroidRuntime(2203):     at java.lang.VMClassLoader.findLoadedClass(Native Method)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:354)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at java.lang.ClassLoader.loadClass(ClassLoader.java:491)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.support.v4.app.Fragment.isSupportFragmentClass(Fragment.java:436)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:255)
04-28 01:22:50.928: E/AndroidRuntime(2203):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
04-28 01:22:50.928: E/AndroidRuntime(2203):     ... 21 more
04-28 01:22:52.348: I/Process(2203): Sending signal. PID: 2203 SIG: 9
04-28 01:22:53.648: E/cutils-trace(2320): Error opening trace file: No such file or directory (2)
04-28 01:22:53.660: D/TilesManager(2320): Starting TG #0, 0xb85da558
04-28 01:22:53.660: D/TilesManager(2320): new EGLContext from framework: b838d3c8 
04-28 01:22:53.660: D/GLWebViewState(2320): Reinit shader
04-28 01:22:53.768: D/GLWebViewState(2320): Reinit transferQueue
舱单:

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.sadaka"
    android:versionCode="1"
    android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <permission 
        android:name="com.example.sadaka.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>

    <uses-permission android:name="com.example.sadaka.permission.MAPS_RECEIVE"/>
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />
<uses-feature android:glEsVersion="0x00020000"
    android:required="true"/>
    <application
        android:allowBackup="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <uses-library android:name="com.google.android.maps" />
        <meta-data 
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyAZ4ntXyoqLud8mjORXQPuCUsQ9yTrLUD4"/>
        <meta-data 
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version"/>

        <activity
            android:name=".Splash"
            android:label="@string/app_name" >
                        <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.example.sadaka.MAINACTIVITY"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
        </activity>
          <activity
            android:name=".Donate"
            android:label="@string/app_name" >
                <intent-filter>
            <action android:name="com.example.sadaka.DONATE"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
        </activity>
         <activity
            android:name=".Zakat"
            android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="com.example.sadaka.ZAKAT"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                </intent-filter>
        </activity>
                 <activity
            android:name=".Inf"
            android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="com.example.sadaka.INF"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                </intent-filter>
        </activity>
                         <activity
            android:name=".Cont"
            android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="com.example.sadaka.CONT"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                </intent-filter>
        </activity>       
        <activity
            android:name=".About"
            android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="com.example.sadaka.ABOUT"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                </intent-filter>
        </activity>       
            </application>

</manifest>


感谢您的帮助

您添加的片段XML不是谷歌地图片段,而是您刚刚创建的片段

更改此选项:

<fragment 
    android:id="@+id/fr"
    android:layout_width="wrap_content"
    android:layout_height="200dp"
    />
<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"/>

至:

<fragment 
    android:id="@+id/fr"
    android:layout_width="wrap_content"
    android:layout_height="200dp"
    />
<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"/>


您想发布您的XML代码吗?但我刚刚先发布了它。或者您是指其他内容?在xmlns:android=”“上为标记片段找到了意外的名称空间前缀“xmlns”。在我删除这个后,它不会转到all@user3579259从xmlI删除的片段中删除xmlns:android=“”,但现在它不会跳转到Cont-pageAccepted。但是为了投票,我至少需要15个声望点