android - gradle配置recyclerview引用是報(bào)錯(cuò),提示安裝對(duì)應(yīng)的Support Repository,請(qǐng)問(wèn)如何解決。
問(wèn)題描述
gradle配置recyclerview引用是報(bào)錯(cuò),提示安裝對(duì)應(yīng)的Support Repository,請(qǐng)問(wèn)如何解決。我的引用代碼如下:
dependencies { compile fileTree(dir: ’libs’, include: [’*.jar’]) androidTestCompile(’com.android.support.test.espresso:espresso-core:2.2.2’, {exclude group: ’com.android.support’, module: ’support-annotations’ }) compile ’com.android.support:appcompat-v7:25.1.0’ complie ’com.android.support:recyclerview-v7:25.0.1’ testCompile ’junit:junit:4.12’}
完整的報(bào)錯(cuò)的如下:
Error:Could not find method complie() for arguments [com.android.support:recyclerview-v7:25.0.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.Please install the Android Support Repository from the Android SDK Manager. <a href='http://www.leifengta.com.cn/wenda/openAndroidSdkManager'>Open Android SDK Manager</a>
根據(jù)提示我安裝了所有我覺得有關(guān)系的SDK,但是報(bào)錯(cuò)還是存在。

問(wèn)題解答
回答1:安卓支持庫(kù)在 SDK 目錄下,版本統(tǒng)一一下即可。
compile ’com.android.support:appcompat-v7:25.1.0’compile ’com.android.support:recyclerview-v7:25.1.0’回答2:
compile ’com.android.support:appcompat-v7:+’compile ’com.android.support:recyclerview-v7:+’在不知道您版本的時(shí)候也可用+號(hào),壞處是可能會(huì)引起編譯變慢,因?yàn)闀?huì)去網(wǎng)絡(luò)上去找最新的。

網(wǎng)公網(wǎng)安備