我有
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'io.realm:android-adapters:1.3.0'
在我的build.gradle(Module:app)文件中。当我同步gradle文件时,它说找不到recyclerview-v7.jar(com.android.support:recyclerview-v7: 24.1.1)
。为什么它现在不能正确构建,我的意思是它已经成功构建了recyclerview-v7 jar文件(我已经在没有Android适配器的情况下使用它)。如何在没有此错误的情况下构建Android适配器?
// Project level build.gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "io.realm:realm-gradle-plugin:1.2.0"
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// App level build.gradle file
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.beacon.retailersgear"
minSdkVersion 11
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
// RecyclerView and CardView
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'io.realm:android-adapters:1.3.0'
}
答案 0 :(得分:0)
realm:android-adapters
似乎带来了compile 'com.android.support:recyclerview-v7:23.3.0'
,因此您应该将其排除在外。
compile('io.realm:android-adapters:1.3.0') {
exclude module: 'recyclerview-v7'
}
(虽然这很奇怪,因为我之前从未遇到过这个问题,尽管使用新版本......)