2016-11-08 92 views
0

当我尝试在android studio版本2.2中构建地图活动时出现以下错误: “找不到与给定值匹配的资源名称'android:TextAppearance.Material.Widget.Button.Inverse'“ 请给我解决方案。找不到与给定名称匹配的资源'android:TextAppearance.Material.Widget.Button.Inverse'

+1

[错误检索父的项目可能重复:无找到的资源与捐赠相匹配ñ名称升级到AppCompat v23后](http://stackoverflow.com/questions/32075498/error-retrieving-parent-for-item-no-resource-found-that-matches-the-given-name) –

回答

-1

使用Google ApiClient是当您正在进行基于位置的工作时最好的方法。 https://developers.google.com/android/reference/com/google/android/gms/common/api/GoogleApiClient

当你想连接到谷歌的API的一个在谷歌Play服务库提供 (如谷歌登入的游戏,或 驱动器),你需要创建GoogleApiClient的实例(“Google API 客户端”)。 Google API客户端为所有Google Play服务提供了所有 的通用入口点,并管理用户设备与每个Google服务之间的网络连接,网址为 。

  • 自动管理,以谷歌Play服务的连接。

  • 对任何Google Play服务执行同步和异步API调用。

  • 在必要的情况下,在罕见的 情况下手动管理您与Google Play服务的连接。

添加这清单文件

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.google.android.gms.location.sample.basiclocationsample" > 

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> 
</manifest> 

添加该代码在你的活动

mGoogleApiClient = new GoogleApiClient.Builder(this) 
      .addApi(Drive.API) 
      .addScope(Drive.SCOPE_FILE) 
      .addConnectionCallbacks(this) 
      .addOnConnectionFailedListener(this) 
      .build() 
@Override 
    public void onConnected(Bundle connectionHint) { 
     mLastLocation = LocationServices.FusedLocationApi.getLastLocation(
       mGoogleApiClient); 
     if (mLastLocation != null) { 
      mLatitudeText.setText(String.valueOf(mLastLocation.getLatitude())); 
      mLongitudeText.setText(String.valueOf(mLastLocation.getLongitude())); 
     } 
    } 
+0

你是否你确定你在正确的问题上发布了这个答案吗?这里的OP没有提到有关位置服务的任何信息。他们正在构建问题。 –

相关问题