2016-11-08 93 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沒有提到有關位置服務的任何信息。他們正在構建問題。 –

相關問題