为JellyRefreshLayout模块导入新的Android模块失败

Wae*_*hah 5 java import android module java-8

我正在导入JellyRefreshLayout作为模块(对于某些更新)

检查此链接:https: //github.com/allan1st/JellyRefreshLayout

但我总是得到这个gradle构建错误:

信息:Gradle任务[:app:generateDebugSources,

:app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :jellyrefresh:generateDebugSources, :jellyrefresh:mockableAndroidJar, :jellyrefresh:prepareDebugUnitTestDependencies, :jellyrefresh:generateDebugAndroidTestSources]
extractDebugAnnotations is incompatible with java 8 sources and has been disabled.
extractReleaseAnnotations is incompatible with java 8 sources and has been disabled.
:jellyrefresh:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:jellyrefresh:compileReleaseJavaWithJavac UP-TO-DATE
:jellyrefresh:compileRetrolambdaRelease FAILED

Error:Execution failed for task ':jellyrefresh:compileRetrolambdaRelease'.
> Could not resolve all dependencies for configuration ':jellyrefresh:retrolambdaConfig'.
   > Could not resolve net.orfjackal.retrolambda:retrolambda:2.0.3.
     Required by:
         JellyRefreshLayout-master:jellyrefresh:unspecified
      > No cached version of net.orfjackal.retrolambda:retrolambda:2.0.3 available for offline mode.
      > No cached version of net.orfjackal.retrolambda:retrolambda:2.0.3 available for offline mode.
Run Code Online (Sandbox Code Playgroud)

项目gradle build:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.3'
        classpath 'me.tatarka:gradle-retrolambda:3.2.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
Run Code Online (Sandbox Code Playgroud)

应用程序gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "uk.co.imallan.jellyrefreshlayout"
        minSdkVersion 19
        targetSdkVersion 22
        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:23.3.0'
    compile project(":jellyrefresh")
}
Run Code Online (Sandbox Code Playgroud)

图书馆模型:

repositories {
    mavenCentral()
}

apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.3.0'
}
Run Code Online (Sandbox Code Playgroud)

注意:我的项目JDK选择和默认JDK是: /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home

请指教 !谢谢 !

Wae*_*hah 0

现在已经解决了。

问题是:internal_impl.jar 有时不在retrolambda 类路径上。因为以下原因之一:

  • 因为依赖项可能会在第二次执行时更新。
  • 也许这是 Gradle Android 插件中的一个错误。

解决方案是:在同步 gradle 之前,我从 gradle 终端在命令中运行 gradle 清理和组装:

./gradlew clean assembleDebug

从 Gradle 终端。

请检查这个有用的对话:

https://github.com/evant/gradle-retrolambda/issues/105