我試圖使用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
但安裝這個軟件庫將創建支持庫的問題與編譯版本不匹配。
我做錯了什麼?
也許這就是原因,因爲像你說的那樣,你使用了不推薦的功能。所以最好的方法是更新您使用的代碼,並使用[documentation](https://developers.google.com/gmail/api/quickstart/android)中的最新版本的android sdk。因此,在使用sdk 23之後,使用appcompat-v7不會有任何問題:23.4.0 – KENdi