1

我試圖使用Android版Gmail的API與API 21 設備在本教程中開發的Gmail API:https://developers.google.com/gmail/api/quickstart/android 它說我需要有:爲Android SDK 21

Android SDK packages for API 23 or later, including the latest versions of Google Repository, Android Support Library and Google Play Services.

而且依賴例如有:

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
compile 'com.android.support:appcompat-v7:23.4.0' 
compile 'com.google.android.gms:play-services-auth:9.0.2' 
compile 'pub.devrel:easypermissions:0.1.5' 
compile('com.google.api-client:google-api-client-android:1.22.0') { 
    exclude group: 'org.apache.httpcomponents' 
} 
compile('com.google.apis:google-api-services-gmail:v1-rev47-1.22.0') { 
    exclude group: 'org.apache.httpcomponents' 
} 
} 

,但我得到一個錯誤,當我使用它說我不能使用: com.android.support:appcompat-v7:23.4.0 當我編譯SDK版本是21

我試圖改變appcompact版本V7:21.0.2這之前,爲我工作,但是當我在同步的gradle文件,我得到的錯誤:

Error: Failed to resolve: com.android.support:appcompat-v7:23.1.1
Install Repository and sync project
Open File
Show in Project Structure dialog

但安裝這個軟件庫將創建支持庫的問題與編譯版本不匹配。

我做錯了什麼?

+0

也許這就是原因,因爲像你說的那樣,你使用了不推薦的功能。所以最好的方法是更新您使用的代碼,並使用[documentation](https://developers.google.com/gmail/api/quickstart/android)中的最新版本的android sdk。因此,在使用sdk 23之後,使用appcompat-v7不會有任何問題:23.4.0 – KENdi

回答

0

你可以試着去SDK管理器,安裝三個組成:谷歌儲存庫,Android的支持庫和谷歌播放服務。 像下面的圖片: enter image description here

+0

我已經全部安裝了它們。儘管Android Support Repository版本爲33,我可以將其更新爲35. –

+0

是的,請更新至最新版本。到23 – alway5dotcom

+0

我更新了Android的支持庫和Android的SDK構建的工具來23也更新SDK構建的工具現在,當我同步我得到這些錯誤: 爲項目'錯誤檢索父:沒有資源發現匹配鑑於name' 1 '機器人:TextAppearance.Material.Widget.Button.Inverse'。 2.'android:Widget.Material.Button.Colored'。 我仍然得到了:'如果我嘗試使用程序兼容性-V7支持庫不應該使用不同版本的compileSdkVersion'錯誤:23.4.0依賴。 –

相關問題