Java Android Studio地图未显示

Java Android Studio地图未显示,java,android,android-studio,maps,manifest,Java,Android,Android Studio,Maps,Manifest,我在家是因为冠状病毒的争论,所以我正在努力推进我的研究。现在我在创建地图应用程序时遇到了Android Studio问题。该应用程序需要通过纬度和经度查找位置,也需要通过名称查找城市,并使用floatingAction按钮定位您的位置。代码运行得很好,当我添加代码来定位你的位置时,地图不再显示了。它加载时没有错误,但贴图不起作用 舱单 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://

我在家是因为冠状病毒的争论,所以我正在努力推进我的研究。现在我在创建地图应用程序时遇到了Android Studio问题。该应用程序需要通过纬度和经度查找位置,也需要通过名称查找城市,并使用floatingAction按钮定位您的位置。代码运行得很好,当我添加代码来定位你的位置时,地图不再显示了。它加载时没有错误,但贴图不起作用

舱单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.pt3_googlemaps_filipetto_patricio">

    <!--
         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.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

    <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="AIzaSyAHwtaI8O698ZSeVM8Y4xvjRXxAYi9Kr38" />
        <uses-library android:name="com.google.android.maps" />

        <activity
            android:name=".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>

</manifest>

我添加了这个,当我点击按钮查找我的位置并移动到它

 FloatingActionButton myUBICATION = findViewById(R.id.myUBICATION);
        myUBICATION.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if(mMap != null){
                    mMap.setOnMyLocationClickListener(new GoogleMap.OnMyLocationClickListener() {
                        @Override
                        public void onMyLocationClick(@NonNull Location location) {

                            LatLng GPS = new LatLng(location.getLatitude(), location.getLongitude());
                            mMap.addMarker(new MarkerOptions().position(GPS).title("Marker my ubication"));
                            mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(GPS, 10));
                        }
                    });
                }

            }
        });

我添加了这个,当我点击按钮查找我的位置并移动到它

 FloatingActionButton myUBICATION = findViewById(R.id.myUBICATION);
        myUBICATION.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if(mMap != null){
                    mMap.setOnMyLocationClickListener(new GoogleMap.OnMyLocationClickListener() {
                        @Override
                        public void onMyLocationClick(@NonNull Location location) {

                            LatLng GPS = new LatLng(location.getLatitude(), location.getLongitude());
                            mMap.addMarker(new MarkerOptions().position(GPS).title("Marker my ubication"));
                            mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(GPS, 10));
                        }
                    });
                }

            }
        });

你添加了什么破坏了密码?这可能是关于您的密钥上的google api权限的问题。您添加了哪些内容破坏了代码?这可能是关于您的密钥上的google api权限的问题。