构建代码时遇到以下错误...
Android依赖项'com.android.support:support-v4'具有不同版本的编译(21.0.3)和运行时(27.1.1)类路径。您应该通过DependencyResolution手动设置相同的版本
我知道这是 build.gradle 问题。但是我似乎无法看到冲突。我有两个模块我的主要和一个库。
这低于我对主模块的依赖。
dependencies {
implementation 'com.android.support:multidex:1.0.3'
api 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:gridlayout-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
implementation 'com.github.bumptech.glide:glide:4.0.0-RC0'
implementation project(':Library')
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'recyclerview-v7'
exclude group: 'com.android.support', module: 'gridlayout-v7'
}
}
以下是该库的依赖项。
dependencies {
implementation 'com.android.support:design:27.1.1'
api 'com.annimon:stream:1.1.9'
implementation 'commons-net:commons-net:3.6'
api 'org.apache.commons:commons-collections4:4.1'
implementation 'commons-io:commons-io:2.5'
api 'com.android.support:appcompat-v7:27.1.1'
api 'me.grantland:autofittextview:0.2.1'
implementation 'com.marcouberti.autofitbutton:android-auto-fit-button:0.1.1@aar'
api 'com.github.barteksc:android-pdf-viewer:2.4.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
}
所以我的问题是依赖关系还隐藏在哪里?
编辑添加构建文件的其余部分。
android {
signingConfigs {
release {
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
}
}
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "my.id"
minSdkVersion 19
targetSdkVersion 27
versionCode = 3000002
versionName "v3.00.02"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
buildConfigField "boolean", "USE_HEARTBEAT", "true"
buildConfigField "boolean", "LAUNCH_APP_AFTER_APK_UPDATE", "false"
buildConfigField "Boolean", "HIDE_COMMON_LOGS", "true"
buildConfigField "String", "FTP_MEDIA_FOLDER_PATH", "\"s2/media/\""
buildConfigField "Boolean", "WIFI_ENABLED", "true"
}
buildTypes {
// Rename the output files for all variants
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "S2-" + variant.properties.flavorName.replace("S2_", "").replace("orion", "") + "-UPDATE-" + variant.versionName + ".apk"
}
}
release {
manifestPlaceholders = [appName: "@string/app_name"]
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
manifestPlaceholders = [appName: "@string/app_name_debug"]
applicationIdSuffix '.debug'
versionNameSuffix '.debug'
ext.enableCrashlytics = false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
api 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:gridlayout-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
implementation 'com.github.bumptech.glide:glide:4.0.0-RC0'
implementation project(':Library')
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'recyclerview-v7'
exclude group: 'com.android.support', module: 'gridlayout-v7'
}
}
答案 0 :(得分:0)
从
开始时出现问题compileSdkVersion 26
到
compileSdkVersion 27
现在回到26岁。