你好,我在android依赖项上遇到问题,它显示了recyclerview错误“'com.android.support:recyclerview-v7'具有不同版本的编译(22.1.1)和运行时(27.1.0)类路径”
这与公共图书馆的recyclerview冲突。请检查gradle文件并提供一些解决方案。
问题
Caused by: java.lang.RuntimeException: Android dependency 'com.android.support:recyclerview-v7' has different version for the compile (22.1.1) and runtime (27.1.0) classpath. You should manually set the same version via DependencyResolution
at com.android.build.gradle.internal.tasks.AppPreBuildTask.lambda$run$0(AppPreBuildTask.java:104)
at com.android.build.gradle.internal.tasks.AppPreBuildTask.handleArtifact(AppPreBuildTask.java:119)
at com.android.build.gradle.internal.tasks.AppPreBuildTask.run(AppPreBuildTask.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:780)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:747)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
项目级别分级
//顶层构建文件,您可以在其中添加所有子项目/模块共有的配置选项。
buildscript {
ext.kotlin_version = '1.2.31'
ext {
propCompileSdkVersion = 27
propMinSdkVersion = 16
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '3.18.6'
kotlin_version = '1.2.31'
support_libs = '27.1.0'
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用级爬网
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.abc.gallery"
minSdkVersion 16
targetSdkVersion 27
versionCode 169
versionName "3.6.3"
multiDexEnabled true
setProperty("archivesBaseName", "gallery")
}
signingConfigs {
release
}
buildTypes {
debug {
applicationIdSuffix ".debug"
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
ext {
leakCanaryVersion = '1.5.4'
}
dependencies {
// implementation 'com.simplemobiletools:commons:3.17.23'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'it.sephiroth.android.exif:library:1.0.1'
implementation 'com.github.bumptech.glide:glide:4.6.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.12'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
//implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.9.0'
implementation 'com.github.tibbi:subsampling-scale-image-view:v3.10.0-fork'
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
implementation project(':commons')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.booking:rtlviewpager:1.0.1'
implementation 'com.google.code.gson:gson:2.8.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
implementation 'com.github.ajalt.reprint:core:3.2.1@aar'
implementation 'com.bignerdranch.android:recyclerview-multiselect:0.2'
}
Properties props = new Properties()
def propFile = new File('signing.properties')
if (propFile.canRead()) {
props.load(new FileInputStream(propFile))
if (props != null && props.containsKey('STORE_FILE') && props.containsKey('KEY_ALIAS') && props.containsKey('PASSWORD')) {
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
android.signingConfigs.release.storePassword = props['PASSWORD']
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
android.signingConfigs.release.keyPassword = props['PASSWORD']
} else {
println 'signing.properties found but some entries are missing'
android.buildTypes.release.signingConfig = null
}
} else {
println 'signing.properties not found'
android.buildTypes.release.signingConfig = null
}
repositories {
mavenCentral()
}
图书馆摇篮(通用)
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion propCompileSdkVersion
defaultConfig {
minSdkVersion propMinSdkVersion
targetSdkVersion propTargetSdkVersion
versionCode propVersionCode
versionName propVersionName
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
consumerProguardFiles 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
dependencies {
implementation "com.android.support:design:$support_libs"
implementation "com.android.support:appcompat-v7:$support_libs"
implementation 'com.github.bumptech.glide:glide:4.6.1'
implementation 'com.booking:rtlviewpager:1.0.1'
implementation 'com.andrognito.patternlockview:patternlockview:1.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.bignerdranch.android:recyclerview-multiselect:0.2'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.github.ajalt.reprint:core:3.2.1@aar'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
}
apply from: '../bintray-upload.gradle'
答案 0 :(得分:0)
您必须COMPOSER_DATASOURCES='{
"db": {
"name": "db",
"connector": "mongodb",
"host": "mongo",
"useNewUrlParser": "true"
}
}'
使用它
不是implementation 'com.android.support:recyclerview-v7:28.0.0'