注意。 这不是 this 的副本问题,但扩展是因为我得到的错误很少,而且该问题中所述的解决方案并没有解决我的错误。
问题:
最近我正在将我的旧项目迁移到更高版本。我已将 Android Studio 更新到 3.1 并将 API 27 与 Gradle 4.4 一起使用。我已经将 depricated compile
更改为 implementation
现在我面临一个非常奇怪的错误。我说得很奇怪,因为我尝试了其他问题和答案中所述的许多解决方案,但没有任何帮助。除了 :app@debug/compileClasspath
我还收到以下错误
:app@debugAndroidTest/compileClasspath
:app@debugUnitTest/compileClasspath
:app@release/compileClasspath
:app@releaseUnitTest/compileClasspath
我认为所有的错误都是相关的。我在每个库中都收到了这一长串错误。
这是我的应用 build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.epp.app.myproject"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
maven { url uri('https://jitpack.io') }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven {url uri('https://oss.sonatype.org/content/repositories/snapshots/')}
google()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.github.rey5137:material:1.2.4'
implementation 'com.github.gabrielemariotti.cards:cardslib-core:2.1.0'
implementation 'com.github.gabrielemariotti.cards:cardslib-cards:2.1.0'
implementation 'com.github.gabrielemariotti.cards:cardslib-recyclerview:2.1.0'
implementation 'com.github.gabrielemariotti.cards:cardslib-extra-staggeredgrid:2.1.0'
implementation 'com.github.ksoichiro:android-observablescrollview:1.5.0'
implementation 'devlight.io:navigationtabbar:1.2.5'
implementation('com.mikepenz:materialdrawer:6.0.7@aar') {
transitive = true
}
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.github.Netural:RemoteAppControl:1.0.0'
implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
}
这是我的模块 build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
repositories {
jcenter()
mavenCentral()
google()
}
task clean(type: Delete) {
delete rootProject.buildDir
}
最佳答案
我已经找到了解决办法。存在存储库冲突。从模块 build.gradle
的 buildScript
中删除 mavenCentral()
就像一个奇迹。
关于android - 无法解析 ':app@releaseUnitTest/compileClasspath' : Could not resolve com. android.support :appcompat-v7:27. 1.1 的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49892539/