我试图使用RecyclerView,已经在我的build.gradle(app)
中添加了以下行:implementation 'com.android.support:recyclerview-v7:28.0.0-alpha3'
,但是它出现了错误Failed to resolve: com.android.support:recyclerview-v7:28.1.1
。我看到其他答案建议添加:
allprojects {
repositories {
google()
jcenter()
}
}
我已经尝试将以下内容添加到build.gradle
文件中,但是它已经存在并且没有帮助解决问题。所有的SDK工具都已经安装并更新至最新版本。
build.gradle(Project):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
roomVersion = '1.1.1'
archLifecycleVersion = '1.1.1'
}
build.gradle(App):
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.findmyitem"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:recyclerview-v7:28.1.1'
}
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
和implementation 'com.android.support:recyclerview-v7:28.0.0-rc01'
。 - AskNilesh