运行Google Maps活动时,我出现白屏

时间:2018-07-03 16:51:58

标签: android google-maps android-activity

我设置了google api并在具有google play服务的三星设备上运行该应用程序,但是即使我有互联网连接并激活了google位置,我也没有在屏幕上显示带有google徽标的屏幕。 >

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.myapplication" >
<!--
     The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
     Google Maps Android API v2, but you must specify either coarse or fine
     location permissions for the 'MyLocation' functionality. 
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme" >
    <!--
         The API key for Google Maps-based APIs is defined as a string 
resource.
         (See the file "res/values/google_maps_api.xml").
         Note that the API key is linked to the encryption key used to sign 
 the APK.
         You need a different API key for each encryption key, including the 
release key that is used to
         sign the APK for publishing.
         You can define the keys for the debug and release targets in 
src/debug/ and src/release/. 
    -->
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />

    <activity
        android:name="com.example.android.myapplication.MapsActivity"
        android:label="@string/title_activity_maps" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

Api consolethe MapsActivity code

1 个答案:

答案 0 :(得分:0)

确保API密钥不受Android Apps限制,默认情况下受限制

您可以从here

启用它