Error:Execution failed for task ‘:app:compileRetrolambdaDebug’.
Could not resolve all dependencies for configuration ‘:app:retrolambdaConfig’.
Could not resolve net.orfjackal.retrolambda:retrolambda:2.1.0.
Required by:
project :app
Could not resolve net.orfjackal.retrolambda:retrolambda:2.1.0.
Could not load module metadata from C:\Users\Garnet.gradle\caches\modules-2\metadata-2.23\descriptors\net.orfjackal.retrolambda\retrolambda\2.1.0\22da77b0d76ea8df17298218f3ec1f87\descriptor.bin
根目录下的build.gradle如下:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath ‘com.android.tools.build:gradle:2.2.2’
classpath ‘me.tatarka:gradle-retrolambda:3.2.5’
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
compileSdkVersion = 25
buildToolsVersion = “25.0.3”
minSdkVersion = 16
targetSdkVersion = 25
supportVersion = “25.0.0”
}
模块内的build.gradle如下:
apply plugin: ‘com.android.application’
apply plugin: ‘me.tatarka.retrolambda’
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
defaultConfig {
applicationId "com.xxx.xxx"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
sourceSets {
//设置
main {
jniLibs.srcDirs = ["src/main/jniLibs"]
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
dependencies {
compile fileTree(include: [‘*.jar’], dir: ‘libs’)
androidTestCompile(‘com.android.support.test.espresso:espresso-core:2.2.2’, {
exclude group: ‘com.android.support’, module: ‘support-annotations’
})
// compile ‘com.android.support.constraint:constraint-layout:1.0.1’
compile ‘com.android.support:multidex:1.0.1’
testCompile ‘junit:junit:4.12’
compile ‘com.squareup.retrofit2:retrofit:2.1.0’
compile ‘com.squareup.retrofit2:converter-gson:2.1.0’
compile ‘com.squareup.retrofit2:adapter-rxjava:2.1.0’
compile ‘com.squareup.retrofit2:converter-scalars:2.1.0’
compile ‘com.squareup.okhttp3:logging-interceptor:3.8.1’
compile ‘io.reactivex:rxandroid:1.2.0’
compile ‘com.jakewharton:butterknife:7.0.1’
compile ‘com.github.zhaokaiqiang.klog:library:1.6.0’
compile ‘com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.18’
compile ‘com.github.bumptech.glide:glide:3.7.0’
compile ‘org.greenrobot:eventbus:3.0.0’
compile ‘com.nineoldandroids:library:2.4.0’
compile ‘org.litepal.android:core:1.5.0’
compile ‘com.github.chaychan:SlideCloseLib:1.0.0’
}
在模块内的build.gradle中dependencies里面加上retrolambdaConfig’net.orfjackal.retrolambda:retrolambda:2.3.0’之后还是会报错,多次clean project也没有解决问题,把修改之后的项目移到另一个目录下面也会出现这个问题;
最后把未修改的代码放到新的目录下面,在其模块内的build.gradle中dependencies里面加上retrolambdaConfig’net.orfjackal.retrolambda:retrolambda:2.3.0’解决该问题