Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.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 谷歌地图v2未加载_Android_Google Maps_Android Activity - Fatal编程技术网

Android 谷歌地图v2未加载

Android 谷歌地图v2未加载,android,google-maps,android-activity,Android,Google Maps,Android Activity,谷歌地图不会加载,会显示一个空白屏幕 尝试了一些指南,也尝试了谷歌的指南,但似乎都不起作用 这就是我所补充的,找不到问题:-/ 日志: 06-27 01:21:16.470: I/Google Maps Android API(12628): Google Play services client version: 4452000 06-27 01:21:16.490: I/Google Maps Android API(12628): Google Play services package

谷歌地图不会加载,会显示一个空白屏幕 尝试了一些指南,也尝试了谷歌的指南,但似乎都不起作用 这就是我所补充的,找不到问题:-/

日志:

06-27 01:21:16.470: I/Google Maps Android API(12628): Google Play services client version: 4452000
06-27 01:21:16.490: I/Google Maps Android API(12628): Google Play services package version: 4452036
06-27 01:21:16.790: D/dalvikvm(12628): GC_FOR_ALLOC freed 3003K, 16% free 17823K/21008K, paused 32ms, total 33ms
06-27 01:21:16.800: I/fpp(12628): Making Creator dynamically
06-27 01:21:16.800: I/Google Maps Android API(12628): Google Play services client version: 4452000
06-27 01:21:16.810: W/ActivityThread(12628): ClassLoader.loadClass: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());
06-27 01:21:17.261: I/Google Maps Android API(12628): Failed to contact Google servers. Another attempt will be made when connectivity is established.
06-27 01:21:24.709: D/dalvikvm(12628): GC_FOR_ALLOC freed 3259K, 15% free 19643K/23084K, paused 40ms, total 40ms
06-27 01:21:32.367: E/Google Maps Android API(12628): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
android清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    android:versionName="1.0.0"
    android:versionCode="1"
    package="com.sahaab.android.muslimzone.test" >
    <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19" />

    <!-- The following two permissions are not required to use
     Google Maps Android API v2, but are recommended. -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

    <!-- Required OpenGL ES 2.0. for Maps V2 -->
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />    

    <permission
            android:name="com.sahaab.android.muslimzone.test.permission.MAPS_RECEIVE"
            android:protectionLevel="signature"/>

    <uses-permission android:name="com.sahaab.android.muslimzone.test.permission.MAPS_RECEIVE"/>

    <uses-permission android:name="android.permission.INTERNET" />
    <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-feature
        android:name="android.hardware.location"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.location.network"
        android:required="false" />
    <uses-feature android:name="android.hardware.location.gps" />
    <uses-feature
        android:name="android.hardware.wifi"
        android:required="false" />    

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
             android:name="com.google.android.maps.v2.API_KEY"
             android:value="AIzaSyDTkYW-kWs9VKB40pv7Qhw972blaz-GD1A" />

        <activity
            android:name="com.sahaab.muslimzone.activity.MainActivity"
            android:label="@string/app_name"
            android:launchMode="singleTop" >
            <meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".activities.MyActivity" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <activity
            android:name="com.sahaab.muslimzone.activity.InfoActivity"
            android:label="@string/app_name"
            android:launchMode="singleTop" >
            <meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".activities.MyActivity" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <activity
            android:name="com.sahaab.muslimzone.activity.IqamahActivity"
            android:label="@string/app_name"
            android:launchMode="singleTop" >
            <meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".activities.MyActivity" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

    </application>

</manifest>
布局:

<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/iqamah_map"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:name="com.google.android.gms.maps.MapFragment"/>

更新您的代码。我希望它能帮助您。这对我有用

package com.sahaab.muslimzone.activity;

import com.sahaab.android.muslimzone.test.R;

import android.app.Activity;
import android.os.Bundle;

public class IqamahActivity extends FragmentActivity {

GoogleMap map;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_iqamah);
map =((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.iqamah_map)).getMap();

    }
}
更改您的XML

 <?xml version="1.0" encoding="utf-8"?>
    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/iqamah_map"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:name="com.google.android.gms.maps.SupportMapFragment" />


有关详细信息,请访问

更新您的代码。我希望它对您有所帮助。这对我有用

package com.sahaab.muslimzone.activity;

import com.sahaab.android.muslimzone.test.R;

import android.app.Activity;
import android.os.Bundle;

public class IqamahActivity extends FragmentActivity {

GoogleMap map;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_iqamah);
map =((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.iqamah_map)).getMap();

    }
}
更改您的XML

 <?xml version="1.0" encoding="utf-8"?>
    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/iqamah_map"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:name="com.google.android.gms.maps.SupportMapFragment" />


有关详细信息,请访问

更新您的代码。我希望它对您有所帮助。这对我有用

package com.sahaab.muslimzone.activity;

import com.sahaab.android.muslimzone.test.R;

import android.app.Activity;
import android.os.Bundle;

public class IqamahActivity extends FragmentActivity {

GoogleMap map;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_iqamah);
map =((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.iqamah_map)).getMap();

    }
}
更改您的XML

 <?xml version="1.0" encoding="utf-8"?>
    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/iqamah_map"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:name="com.google.android.gms.maps.SupportMapFragment" />


有关详细信息,请访问

更新您的代码。我希望它对您有所帮助。这对我有用

package com.sahaab.muslimzone.activity;

import com.sahaab.android.muslimzone.test.R;

import android.app.Activity;
import android.os.Bundle;

public class IqamahActivity extends FragmentActivity {

GoogleMap map;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_iqamah);
map =((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.iqamah_map)).getMap();

    }
}
更改您的XML

 <?xml version="1.0" encoding="utf-8"?>
    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/iqamah_map"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:name="com.google.android.gms.maps.SupportMapFragment" />


有关详细信息,请访问

Amiya是正确的,您需要使用才能使用片段

要找出活动和碎片活动之间的区别,可能会有所帮助

如果您的目标是API 12及以上版本,则可以使用MapFragment。否则,请使用SupportMapFragment

SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
点击查看更多关于谷歌地图Android API v2的信息


希望这有帮助

Amiya是对的,您需要使用来使用片段

要找出活动和碎片活动之间的区别,可能会有所帮助

如果您的目标是API 12及以上版本,则可以使用MapFragment。否则,请使用SupportMapFragment

SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
点击查看更多关于谷歌地图Android API v2的信息


希望这有帮助

Amiya是对的,您需要使用来使用片段

要找出活动和碎片活动之间的区别,可能会有所帮助

如果您的目标是API 12及以上版本,则可以使用MapFragment。否则,请使用SupportMapFragment

SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
点击查看更多关于谷歌地图Android API v2的信息


希望这有帮助

Amiya是对的,您需要使用来使用片段

要找出活动和碎片活动之间的区别,可能会有所帮助

如果您的目标是API 12及以上版本,则可以使用MapFragment。否则,请使用SupportMapFragment

SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
点击查看更多关于谷歌地图Android API v2的信息



希望这有帮助

@integer/google\u play\u services\u版本的值是多少?请检查我的答案。thnx,抱歉我睡着了xd@integer/google\u play\u services\u版本的值是多少?请检查我的答案。thnx,抱歉我睡着了xd@integer/google\u play\u services\u版本的值是多少?请检查我的答案。thnx,抱歉我睡着了xd@integer/google\u play\u services\u版本的值是多少?请检查我的答案。thnx,抱歉我睡着了XD@SimplePlan主席先生:我也面对同样的问题。然后使用它。实际上SupportMapFragment属于v4支持库,与默认的MagFragment相反,后者是Android中的本机组件。@a这就是原因。但另一个原因是如果您的
minsdk@SimplePlan是的。很高兴收到您的信息。@SimplePlan先生:我也遇到过同样的问题。然后使用它。实际上SupportMapFragment属于v4支持库,与默认的MagFragment相反,后者是Android中的本机组件。@a这就是原因。但另一个原因是如果您的
minsdk@SimplePlan是的。很高兴收到您的信息。@SimplePlan先生:我也遇到过同样的问题。然后使用它。实际上SupportMapFragment属于v4支持库,与默认的MagFragment相反,后者是Android中的本机组件。@a这就是原因。但另一个原因是如果您的
minsdk@SimplePlan是的。很高兴收到您的信息。@SimplePlan先生:我也遇到过同样的问题。然后使用它。实际上SupportMapFragment属于v4支持库,与默认的MagFragment相反,后者是Android中的本机组件。@a这就是原因。但另一个原因是如果您的
minsdk@SimplePlan是的,很高兴收到您的信息。