2016-03-12 85 views
3

請諒解這個錯誤,因爲這是我的第一個android項目! 搖籃同步: pply插件: 'com.android.application'錯誤:(24,11)無法解決:com.android.support:appcompat-v7:8.0.+

android { 
    compileSdkVersion 8 
    buildToolsVersion "23.0.2" 

    defaultConfig { 
     applicationId "com.example.interceptor.myapplication" 
     minSdkVersion 5 
     targetSdkVersion 8 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

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

} 

在搖籃控制檯我得到: 失敗:建立失敗,一個例外。

  • 出錯了: 配置項目':app'時發生問題。

    Could not resolve all dependencies for configuration ':app:_debugCompile'. Could not find any version that matches com.android.support:appcompat-v7:8.0.+. Versions that do not match: 24.0.0-alpha1 23.2.1 23.2.0 23.1.1 23.1.0 + 14 more Searched in the following locations: https://jcenter.bintray.com/com/android/support/appcompat-v7/maven-metadata.xml https://jcenter.bintray.com/com/android/support/appcompat-v7/ file:/D:/Users/INTERCEPTOR/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/maven-metadata.xml file:/D:/Users/INTERCEPTOR/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/maven-metadata.xml file:/D:/Users/INTERCEPTOR/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/ Required by: MyApplication:app:unspecified

  • 嘗試: 與--stacktrace選項獲取堆棧跟蹤運行。使用--info或--debug選項運行以獲取更多日誌輸出。

構建失敗

回答

6

你應該使用正確的版本爲appcompat-v7依賴。

上述依賴的最新穩定版本到現在是:

compile 'com.android.support:appcompat-v7:23.2.1' 

使用它作爲以上,並確保你安裝/升級到最新版本之前SDK管理器

+0

編譯版本是在我開始項目時默認建立的!我正在嘗試爲android 2.2 +創建一個android應用程序(如果它很重要)...但仍然感謝您的解決方案! –

+3

無法安裝23.2.1。 Studio包管理器說它已經下載,但是Gradle說'未能解決' –

+0

@konopko如果你告訴我們有關錯誤的信息不僅僅是'無法解決',可能會有幫助。 –