2016-11-23 47 views
1

加入這行來我的build.gradle未能同步級項目

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
repositories { 
    jcenter() 
} 
dependencies { 
    classpath 'com.android.tools.build:gradle:2.2.2' 
    // in the individual module build.gradle files 
    compile "com.android.support:support-core-utils:25.0.1" 

    } 
} 

allprojects { 
repositories { 
    jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

和同步文件的gradle後。我得到這個錯誤 Error

然後我跟着鏈接,打開的Android SDK管理器,我發現我已經安裝了Android的詢問服務存儲庫

Showing I have installed Android Support Repository

的原因,我加入這個文件到我的等級是因爲它已被張貼在那裏

Cannot resolve symbol 'TabsPagerAdapter' 
+0

根據錯誤信息,將'compile'行放在'build.gradle'文件的錯誤位置。你可能會考慮編輯你的問題併發布完整的'build.gradle'文件。 – CommonsWare

+0

好的,我提出了你的建議。你想把你的編譯行放在哪裏? –

+0

Matias的答案涵蓋了這一點。 FWIW,我提交了[錯誤報告](https://code.google.com/p/android/issues/detail?id=228489)關於安裝Android支持資源庫的錯誤建議。另外,關於'TabsPagerAdapter',Android SDK中沒有這樣的類,我可以找到它,這似乎是一個單獨的問題。 – CommonsWare

回答

2

這條線,這將解決我最初的錯誤:compile "com.android.support:support-core-utils:25.0.1"去其他的build.gradle文件中..你的插件在主build.gradle中,你應該在你的應用程序模塊的特定gradle文件中添加它。