android studio log errr Places API for Android 似乎没有为您的应用启用。它打开和关闭

Posted

技术标签:

【中文标题】android studio log errr Places API for Android 似乎没有为您的应用启用。它打开和关闭【英文标题】:android studio log erorr Places API for Android does not seem to be enabled for your app. it open and closes 【发布时间】:2020-07-24 14:46:16 【问题描述】:

我知道这可能不是新的,我只需要让它工作。

我已经创建了 api 密钥并将其放在清单文件中仍然无法正常工作。在我的 logcat 中它给了我错误 我为我的 api 启用了 place api 我的错误日志 2020-04-11 22:57:13.514 7579-7579/? E/MPlugin:不支持的类:com.mediatek.common.telephony.IOnlyOwnerSimSupport 2020-04-11 22:57:14.331 1300-2669/? E/Volley:[144] BasicNetwork.performRequest:https://www.googleapis.com/placesandroid/v1/autocompleteWidget?key=AIzaSyDYu4t 的意外响应代码 403 2020-04-11 22:57:14.543 1300-5696/? E/Places:您的应用似乎没有启用 Places API for Android。有关详细信息,请参阅https://developers.google.com/places/android/signup。 2020-04-11 22:57:14.583 1300-5696/? E/AsyncOperation: serviceID=65, operation=AutocompleteWidgetQuota OperationException[状态statusCode=PLACES_API_ACCESS_NOT_CONFIGURED,分辨率=null] 在 bicw.a(:com.google.android.gms@200914016@20.09.14 (040304-300565878):1) 在 bici.a(:com.google.android.gms@200914016@20.09.14 (040304-300565878):4) 在 aakp.run(:com.google.android.gms@200914016@20.09.14 (040304-300565878):8) 在 blfm.run(:com.google.android.gms@200914016@20.09.14 (040304-300565878):2) 在 tad.b(:com.google.android.gms@200914016@20.09.14 (040304-300565878):12) 在 tad.run(:com.google.android.gms@200914016@20.09.14 (040304-300565878):7) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 在 tgd.run(:com.google.android.gms@200914016@20.09.14 (040304-300565878):0) 在 java.lang.Thread.run(Thread.java:761) 2020-04-11 22:57:14.588 7553-7553/? E/Places:由于 PLACES_API_ACCESS_NOT_CONFIGURED 而关闭自动完成小部件

这是我的代码

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.general.files.GeneralFunctions;
import com.general.files.GetAddressFromLocation;
import com.general.files.GetLocationUpdates;
import com.general.files.StartActProcess;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.ui.PlaceAutocomplete;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.utils.Utils;
import com.view.MButton;
import com.view.MTextView;
import com.view.MaterialRippleLayout;

public class SearchPickupLocationActivity extends AppCompatActivity implements OnMapReadyCallback, GetAddressFromLocation.AddressFound,GetLocationUpdates.LocationUpdates 

    private String TAG = SearchPickupLocationActivity.class.getSimpleName();

    MTextView titleTxt;
    ImageView backImgView;

    GeneralFunctions generalFunc;
    MButton btn_type2;
    int btnId;

    MTextView placeTxtView;

    boolean isPlaceSelected = false;
    LatLng placeLocation;
    Marker placeMarker;

    SupportMapFragment map;
    GoogleMap gMap;

    GetAddressFromLocation getAddressFromLocation;
    LinearLayout placeArea;
    MTextView homePlaceTxt;
    MTextView workPlaceTxt;

    String userHomeLocationLatitude_str;
    String userHomeLocationLongitude_str;
    String userWorkLocationLatitude_str;
    String userWorkLocationLongitude_str;
    String home_address_str;
    String work_address_str;
    SharedPreferences mpref_place;
    GetLocationUpdates getLastLocation;
    private Location userLocation;
    private Marker locMarker;

    @Override
    protected void onCreate(Bundle savedInstanceState) 
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search_pickup_location);

        generalFunc = new GeneralFunctions(getActContext());


        titleTxt = (MTextView) findViewById(R.id.titleTxt);
        backImgView = (ImageView) findViewById(R.id.backImgView);
        btn_type2 = ((MaterialRippleLayout) findViewById(R.id.btn_type2)).getChildView();
        placeTxtView = (MTextView) findViewById(R.id.placeTxtView);

        homePlaceTxt = (MTextView) findViewById(R.id.homePlaceTxt);
        workPlaceTxt = (MTextView) findViewById(R.id.workPlaceTxt);
        placeArea = (LinearLayout) findViewById(R.id.placeArea);

        map = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapV2);

        getAddressFromLocation = new GetAddressFromLocation(getActContext(), generalFunc);
        getAddressFromLocation.setAddressList(this);

        getLastLocation = new GetLocationUpdates(getActContext(), 8);
        getLastLocation.setLocationUpdatesListener(this);

        setLabels();

        map.getMapAsync(SearchPickupLocationActivity.this);

        backImgView.setOnClickListener(new setOnClickAct());
        btnId = Utils.generateViewId();
        btn_type2.setId(btnId);

        btn_type2.setOnClickListener(new setOnClickAct());
        (findViewById(R.id.pickUpLocSearchArea)).setOnClickListener(new setOnClickAct());
        homePlaceTxt.setOnClickListener(new setOnClickAct());
        workPlaceTxt.setOnClickListener(new setOnClickAct());

        generalFunc.showMessage(generalFunc.getCurrentView(SearchPickupLocationActivity.this), generalFunc.retrieveLangLBl("", "LBL_LONG_TOUCH_CHANGE_LOC_TXT"));


        checkLocations();
    

    public void setLabels() 
        placeTxtView.setText(generalFunc.retrieveLangLBl("", "LBL_SEARCH_PLACE_HINT_TXT"));
        if (getIntent().getStringExtra("isPickUpLoc") != null && getIntent().getStringExtra("isPickUpLoc").equals("true")) 
            titleTxt.setText(generalFunc.retrieveLangLBl("", "LBL_SET_PICK_UP_LOCATION_TXT"));


         else if (getIntent().getStringExtra("isHome") != null && getIntent().getStringExtra("isHome").equals("true")) 
            titleTxt.setText(generalFunc.retrieveLangLBl("", "LBL_ADD_HOME_BIG_TXT"));
            homePlaceTxt.setText(generalFunc.retrieveLangLBl("Home Place", "LBL_HOME_PLACE"));
         else if (getIntent().getStringExtra("isWork") != null && getIntent().getStringExtra("isWork").equals("true")) 
            titleTxt.setText(generalFunc.retrieveLangLBl("", "LBL_ADD_WORK_HEADER_TXT"));
            workPlaceTxt.setText(generalFunc.retrieveLangLBl("Work Place", "LBL_WORK_PLACE"));
         else 
            titleTxt.setText(generalFunc.retrieveLangLBl("", "LBL_SELECT_DESTINATION_HEADER_TXT"));
        

        btn_type2.setText(generalFunc.retrieveLangLBl("", "LBL_ADD_LOC"));




    


    public void checkLocations() 
        mpref_place = PreferenceManager.getDefaultSharedPreferences(getActContext());
        home_address_str = mpref_place.getString("userHomeLocationAddress", null);

        userHomeLocationLatitude_str = mpref_place.getString("userHomeLocationLatitude", null);
        userHomeLocationLongitude_str = mpref_place.getString("userHomeLocationLongitude", null);

        work_address_str = mpref_place.getString("userWorkLocationAddress", null);
        userWorkLocationLatitude_str = mpref_place.getString("userWorkLocationLatitude", null);
        userWorkLocationLongitude_str = mpref_place.getString("userWorkLocationLongitude", null);

        if (getIntent().getStringExtra("isHome") != null && getIntent().getStringExtra("isHome").equals("true")) 

            if (home_address_str != null && !home_address_str.equals("")) 
                homePlaceTxt.setVisibility(View.VISIBLE);
                placeArea.setVisibility(View.GONE);
                (findViewById(R.id.seperationLine)).setVisibility(View.VISIBLE);
            
        
        if (getIntent().getStringExtra("isWork") != null && getIntent().getStringExtra("isWork").equals("true")) 

            if (work_address_str != null && !work_address_str.equals("")) 
                workPlaceTxt.setVisibility(View.VISIBLE);
                placeArea.setVisibility(View.GONE);
                (findViewById(R.id.seperationLine)).setVisibility(View.VISIBLE);
            
        
    



    @Override
    public void onMapReady(GoogleMap googleMap) 

        this.gMap = googleMap;

        mpref_place = PreferenceManager.getDefaultSharedPreferences(getActContext());

        if (getIntent().getStringExtra("isPickUpLoc") != null && getIntent().hasExtra("PickUpLatitude") && getIntent().hasExtra("PickUpLongitude")) 

            LatLng placeLocation = new LatLng(generalFunc.parseDoubleValue(0.0, getIntent().getStringExtra("PickUpLatitude")),
                    generalFunc.parseDoubleValue(0.0, getIntent().getStringExtra("PickUpLongitude")));

            CameraUpdate cu = CameraUpdateFactory.newLatLngZoom(placeLocation, 14.0f);
            gMap.moveCamera(cu);

         else if (getIntent().getStringExtra("isHome") != null && getIntent().getStringExtra("isHome").equals("true") && home_address_str != null && !home_address_str.equals("")) 
            if (mpref_place.getString("userHomeLocationLatitude", null) != null && mpref_place.getString("userHomeLocationLongitude", null) != null) 
                LatLng HomeLocation = new LatLng(generalFunc.parseDoubleValue(0.0, mpref_place.getString("userHomeLocationLatitude", "0.0")),
                        generalFunc.parseDoubleValue(0.0, mpref_place.getString("userHomeLocationLongitude", "0.0")));
                if (HomeLocation.latitude != 0.0 && HomeLocation.longitude != 0.0) 
                    CameraUpdate cu = CameraUpdateFactory.newLatLngZoom(HomeLocation, 14.0f);
//                    addMarker(HomeLocation);
                    gMap.addMarker(new MarkerOptions().position(HomeLocation).title(mpref_place.getString("userHomeLocationAddress", "")));

                    gMap.moveCamera(cu);
                
            
            placeTxtView.setText("" + mpref_place.getString("userHomeLocationAddress", ""));

         else if (getIntent().getStringExtra("isWork") != null && getIntent().getStringExtra("isWork").equals("true") && work_address_str != null && !work_address_str.equals("")) 
            if (mpref_place.getString("userWorkLocationLatitude", null) != null && mpref_place.getString("userWorkLocationLongitude", null) != null) 
                LatLng WorkLocation = new LatLng(generalFunc.parseDoubleValue(0.0, mpref_place.getString("userWorkLocationLatitude", "0.0")),
                        generalFunc.parseDoubleValue(0.0, mpref_place.getString("userWorkLocationLongitude", "0.0")));
                if (WorkLocation.latitude != 0.0 && WorkLocation.longitude != 0.0) 
                    CameraUpdate cu = CameraUpdateFactory.newLatLngZoom(WorkLocation, 14.0f);
//                    addMarker(WorkLocation);
                    gMap.addMarker(new MarkerOptions().position(WorkLocation).title(mpref_place.getString("userWorkLocationAddress", "")));
                    gMap.moveCamera(cu);
                
            
            placeTxtView.setText("" + mpref_place.getString("userWorkLocationAddress", ""));

         else 
            Utils.printLog("Api", "in loc upadate" + userLocation);

            if (userLocation != null) 
                LatLng UserLocation = new LatLng(generalFunc.parseDoubleValue(0.0, "" + userLocation.getLatitude()),
                        generalFunc.parseDoubleValue(0.0, "" + userLocation.getLongitude()));
                Utils.printLog("Api", "in loc upadate" + UserLocation);
                if (UserLocation != null) 
//                    addMarker(UserLocation);
                    gMap.addMarker(new MarkerOptions().position(UserLocation));
                    CameraUpdate cu = CameraUpdateFactory.newLatLngZoom(UserLocation, 14.0f);
                    gMap.moveCamera(cu);
                
             else 
                LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
                locationManager = (LocationManager) getSystemService
                        (Context.LOCATION_SERVICE);
                if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) 
                    return;
                
                Location getLastLocation = locationManager.getLastKnownLocation
                        (LocationManager.PASSIVE_PROVIDER);
                if (getLastLocation != null) 
                    LatLng UserLocation = new LatLng(generalFunc.parseDoubleValue(0.0, "" + getLastLocation.getLatitude()),
                            generalFunc.parseDoubleValue(0.0, "" + getLastLocation.getLongitude()));
                    Utils.printLog("Api", "in loc upadate" + UserLocation);
                    if (UserLocation != null) 
//                        addMarker(UserLocation);
//                        gMap.addMarker(new MarkerOptions().position(UserLocation));
//                        CameraUpdate cu = CameraUpdateFactory.newLatLngZoom(UserLocation, 14.0f);
//                        gMap.moveCamera(cu);

                        getAddressFromLocation.setLocation(UserLocation.latitude, UserLocation.longitude);
                        getAddressFromLocation.setLoaderEnable(true);
                        getAddressFromLocation.execute();
                    
                
            

        

        this.gMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() 
            @Override
            public void onMapLongClick(LatLng latLng) 
                getAddressFromLocation.setLocation(latLng.latitude, latLng.longitude);
                getAddressFromLocation.setLoaderEnable(true);
                getAddressFromLocation.execute();
            
        );

    

    private void addMarker(LatLng location) 
        MarkerOptions marker_opt = new MarkerOptions().position(location);
        marker_opt.icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_dest_marker)).anchor(0.5f, 0.5f);
        locMarker = this.gMap.addMarker(marker_opt);
    

    @Override
    public void onLocationUpdate(Location location) 
        userLocation = location;
    

    @Override
    public void onAddressFound(String address, double latitude, double longitude, String geocodeobject) 
        Utils.printLog("address", ":" + address);
        placeTxtView.setText(address);
        isPlaceSelected = true;
        this.placeLocation = new LatLng(latitude, longitude);

        CameraUpdate cu = CameraUpdateFactory.newLatLngZoom(this.placeLocation, 14.0f);

        if (gMap != null) 
            gMap.clear();
            placeMarker = gMap.addMarker(new MarkerOptions().position(this.placeLocation).title(address));
            gMap.moveCamera(cu);
        
    

    public class setOnClickAct implements View.OnClickListener 

        @Override
        public void onClick(View view) 
            int i = view.getId();
            if (i == R.id.backImgView) 
                SearchPickupLocationActivity.super.onBackPressed();

             else if (i == R.id.pickUpLocSearchArea) 
                try 

                    LatLngBounds bounds = null;

                    if (getIntent().hasExtra("PickUpLatitude") && getIntent().hasExtra("PickUpLongitude")) 

                        LatLng pickupPlaceLocation = new LatLng(generalFunc.parseDoubleValue(0.0, getIntent().getStringExtra("PickUpLatitude")),
                                generalFunc.parseDoubleValue(0.0, getIntent().getStringExtra("PickUpLongitude")));
                        bounds = new LatLngBounds(pickupPlaceLocation, pickupPlaceLocation);
                    

                    Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY)
                            .setBoundsBias(bounds)
                            .build(SearchPickupLocationActivity.this);
                    startActivityForResult(intent, Utils.PLACE_AUTOCOMPLETE_REQUEST_CODE);


                 catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) 
                    e.printStackTrace();
                    generalFunc.showMessage(generalFunc.getCurrentView(SearchPickupLocationActivity.this),
                            generalFunc.retrieveLangLBl("", "LBL_SERVICE_NOT_AVAIL_TXT"));
                
             else if (i == btnId) 

                if (isPlaceSelected == false) 
                    generalFunc.showMessage(generalFunc.getCurrentView(SearchPickupLocationActivity.this),
                            generalFunc.retrieveLangLBl("Please set location.", "LBL_SET_LOCATION"));
                    return;
                

                Bundle bn = new Bundle();
                bn.putString("Address", placeTxtView.getText().toString());
                bn.putString("Latitude", "" + placeLocation.latitude);
                bn.putString("Longitude", "" + placeLocation.longitude);

                new StartActProcess(getActContext()).setOkResult(bn);
                backImgView.performClick();
             else if (i == homePlaceTxt.getId()) 
                onAddressFound(home_address_str, generalFunc.parseDoubleValue(0.0, userHomeLocationLatitude_str),
                        generalFunc.parseDoubleValue(0.0, userHomeLocationLongitude_str),"");
             else if (i == workPlaceTxt.getId()) 
                onAddressFound(work_address_str, generalFunc.parseDoubleValue(0.0, userWorkLocationLatitude_str),
                        generalFunc.parseDoubleValue(0.0, userWorkLocationLongitude_str),"");
            
        
    

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) 
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == Utils.PLACE_AUTOCOMPLETE_REQUEST_CODE) 
            if (resultCode == RESULT_OK) 
                Place place = PlaceAutocomplete.getPlace(this, data);
                Utils.printLog(TAG, "Place:" + place.toString());

                placeTxtView.setText(place.getAddress());
                isPlaceSelected = true;
                LatLng placeLocation = place.getLatLng();

                this.placeLocation = placeLocation;

                CameraUpdate cu = CameraUpdateFactory.newLatLngZoom(placeLocation, 14.0f);

                if (gMap != null) 
                    gMap.clear();
                    placeMarker = gMap.addMarker(new MarkerOptions().position(placeLocation).title("" + place.getAddress()));
                    gMap.moveCamera(cu);
                

             else if (resultCode == PlaceAutocomplete.RESULT_ERROR) 
                Status status = PlaceAutocomplete.getStatus(this, data);
                Utils.printLog(TAG, status.getStatusMessage());

                generalFunc.showMessage(generalFunc.getCurrentView(SearchPickupLocationActivity.this),
                        status.getStatusMessage());
             else if (requestCode == RESULT_CANCELED) 

            
        
    

    public Context getActContext() 
        return SearchPickupLocationActivity.this;
    


我的依赖

dependencies 
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    //    compile 'com.android.support:appcompat-v7:23.4.0'

    //    compile 'com.android.support:multidex:1.0.0'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.google.android.gms:play-services-gcm:9.4.0'
    compile 'com.google.android.gms:play-services-location:9.4.0'
    compile 'com.google.android.gms:play-services-maps:9.4.0'
    compile 'com.google.android.gms:play-services-places:9.4.0'
    compile 'com.google.android.gms:play-services-auth:9.4.0'

    apply plugin: 'com.google.gms.google-services'
    Implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
    Implementation 'com.firebase:firebase-client-android:2.4.1+'
    Implementation 'com.google.firebase:firebase-database:9.4.0'
    Implementation 'com.firebaseui:firebase-ui:0.4.4'
    Implementation 'com.google.firebase:firebase-core:9.4.0'
    Implementation 'com.google.firebase:firebase-messaging:9.4.0'

apply plugin: 'com.google.gms.google-services'

我的 xml 文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_
    android:layout_
    android:orientation="vertical"
    tools:context="com.app85taxi.passenger.SearchPickupLocationActivity">

    <include
        android:id="@+id/toolbar_include"
        layout="@layout/design_toolbar_general" />

    <RelativeLayout
        android:layout_
        android:layout_>

        <fragment
            android:id="@+id/mapV2"
            android:name="com.google.android.gms.maps.SupportMapFragment"
            android:layout_
            android:layout_ />


        <LinearLayout
            android:layout_
            android:layout_
            android:background="#FFFFFF"
            android:orientation="vertical">

            <LinearLayout
                android:id="@+id/pickUpLocSearchArea"
                android:layout_
                android:layout_
                android:orientation="horizontal">

                <ImageView
                    android:layout_
                    android:layout_
                    android:layout_gravity="center_vertical"
                    android:layout_weight="0"
                    android:src="@mipmap/ic_search" />

                <com.view.MTextView
                    android:id="@+id/placeTxtView"
                    android:layout_
                    android:layout_
                    android:layout_weight="1"
                    android:background="@android:color/transparent"
                    android:ellipsize="end"
                    android:gravity="start|center_vertical"
                    android:textAlignment="viewStart"
                    android:maxLines="1"
                    android:textColor="#1C1C1C"
                    android:textSize="@dimen/txt_size_16" />

            </LinearLayout>

            <View
                android:id="@+id/seperationLine"
                android:layout_
                android:layout_
                android:layout_marginEnd="10dp"
                android:layout_marginStart="10dp"
                android:background="#cecece"
                android:visibility="gone" />

            <LinearLayout
                android:id="@+id/placeArea"
                android:layout_
                android:layout_
                android:orientation="horizontal"
                android:visibility="gone">

                <com.view.MTextView
                    android:id="@+id/homePlaceTxt"
                    android:layout_
                    android:layout_
                    android:layout_weight="1"
                    android:gravity="center"
                    android:maxLines="1"
                    android:text="Home Place"
                    android:textColor="#333"
                    android:textSize="@dimen/txt_size_16"
                    android:visibility="gone" />

                <View
                    android:layout_
                    android:layout_
                    android:layout_marginBottom="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_weight="0"
                    android:background="#cecece" />

                <com.view.MTextView
                    android:id="@+id/workPlaceTxt"
                    android:layout_
                    android:layout_
                    android:layout_weight="1"
                    android:gravity="center"
                    android:maxLines="1"
                    android:text="Work Place"
                    android:textColor="#333"
                    android:textSize="@dimen/txt_size_16"
                    android:visibility="gone" />
            </LinearLayout>

        </LinearLayout>


        <include
            android:id="@+id/btn_type2"
            layout="@layout/btn_type_2"
            android:layout_
            android:layout_
            android:layout_alignParentBottom="true"
            android:layout_marginEnd="-8dp"
            android:layout_marginStart="-8dp" />
    </RelativeLayout>
</LinearLayout>

【问题讨论】:

【参考方案1】:

错误是您尚未在您的谷歌云控制台中为此项目启用地点 API 和地图 API,或者您尚未将应用程序的 SHA1 设置为您的项目。 首先验证您是否选择了正确的项目并启用了 Places API for android。 此外,您需要为您的帐户启用计费,我认为您已经启用了。 您可以通过此链接检查您是否启用了 Places API。

确保首先从窗口顶部选择您的项目。

Places API

【讨论】:

我已经为 api 启用了谷歌云控制台,而且现在只有 sha1 会尝试计费 我可以使用或做的任何其他想法@Baljeet 哦,现在我看到了问题所在。您正在使用现已正式关闭的旧场所 API SDK。您可以查看此页面以获取更多信息。您必须将项目迁移到最新的 Places SDK。 developers.google.com/places/android-sdk/client-migration 你能帮我解决这个问题吗?我很难理解@Baljeet 如我所见,您使用的是非常旧版本的 firebase、play 服务、place API 等,因此您必须进行一些更改,因为最新的 firebase 插件版本 >17.0 并放置 SDK v2是全新的独立 SDK,因此请先升级项目中的所有库版本,然后才能看到您遇到的错误。首先升级所有库,然后按照本指南 developers.google.com/places/android-sdk/client-migration

以上是关于android studio log errr Places API for Android 似乎没有为您的应用启用。它打开和关闭的主要内容,如果未能解决你的问题,请参考以下文章

android studio不打印log日志怎么办

Android Studio保存log到本地

关于Android Studio中的Log

[Android Pro] Android studio jni中调用Log输出调试信息

Android Studio无法打印Logout日志

在 Android Studio 中显示 Cordova“console.log”条目