Error: Lambda coming from jar file needs its interfaces for class class to be compiled by RxJava2

I am using RxJava2 along with lambda. IDE - Android Studio. Getting the following error while compiling.

Info: Gradle tasks [: app: generateDebugSources ,: app: mockableAndroidJar ,: app: prepareDebugUnitTestDependencies ,: app: generateDebugAndroidTestSources ,: app: compileDebugSources ,: app: compileDebugUnitTestSources ,: app: compileDebugUnitTestSources: : transport: mockableAndroidJar ,: transport: prepareDebugUnitTestDependencies ,: transport: compileDebugSources ,: transport: compileDebugAndroidTestSources ,: transport: compileDebugUnitTestSources]

Error: Lambda coming from jar file needs their interfaces for the compiled class, unknown interfaces are io.socket.emitter.Emitter $ Listener

Error: Lambda coming from a jar file needs their interfaces for the class to be compiled, the unknown interfaces are io.reactivex.functions.Predicate

Error: Lambda coming from jar file needs their interfaces for the compiled class, unknown interfaces are io.reactivex.functions.Consumer

Error: Lambda coming from jar file needs their interfaces for the compiled class, unknown interfaces are io.socket.emitter.Emitter $ Listener

Error: Lambda coming from jar file needs their interfaces for the compiled class, unknown interfaces are io.socket.emitter.Emitter $ Listener

Error: Lambda coming from jar file needs their interfaces for the compiled class, unknown interfaces are io.reactivex.FlowableOnSubscribe

Error: Lambda coming from jar file needs their interfaces for the compiled class, unknown interfaces are io.socket.emitter.Emitter $ Listener

Error: Lambda coming from jar file needs their interfaces for the compiled class, unknown interfaces are io.socket.emitter.Emitter $ Listener

Error: Execution completed for task ': app: transformClassesWithPreJackPackagedLibrariesForDebug'.

com.android.build.api.transform.TransformException: com.android.builder.core.JackToolchain $ ToolchainException: Jack compilation exception

Following my build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
    applicationId "com.communicator"
    minSdkVersion 15
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
    jackOptions {
        enabled true
    }

    }
    buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    }
    configurations.all {
    resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
    }
    compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
    }
}

ext {
    rxlifecycleVersion = '2.0.1'
    icepickVersion = '3.2.0'
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'io.reactivex.rxjava2:rxjava:2.0.7'
    compile "com.trello.rxlifecycle2:rxlifecycle:$rxlifecycleVersion"
    compile "com.trello.rxlifecycle2:rxlifecycle-android:$rxlifecycleVersion"
    compile "com.trello.rxlifecycle2:rxlifecycle-components:$rxlifecycleVersion"

    compile "frankiesardo:icepick:$icepickVersion"
    provided "frankiesardo:icepick-processor:$icepickVersion"

    compile project(path: ':transport')
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:design:25.3.1'
    testCompile 'junit:junit:4.12'
}

      

The following sequence works.

  • Change minSdkVersion to 25. Synchronize and create a project.
  • Change minSdkVersion again to 15. Synchronize and make the project.

But this makes compilation very slow and I need to follow this sequence after every code change. Is there a better alternative?

+3


source to share


2 answers


This is due to android gradle support. you may need to use the newer version of the android gradle plugin but it is a little tricky at the moment.

I solved the same problem using gradle-android plugin version 2.4.0-alpha7

in build.gradle I added:



classpath 'com.android.tools.build:gradle:2.4.0-alpha7'

      

However this is not enough, the environment variable is also required (because it is an alpha version), see this answer

0


source


Change your gradle android:



classpath 'com.android.tools.build:gradle:2.4.0-'

      

0


source







All Articles