3

I am using RxJava2 along with lambda. IDE is Android Studio. Getting following error when compiling.

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

Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are io.socket.emitter.Emitter$Listener

Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are io.reactivex.functions.Predicate

Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are io.reactivex.functions.Consumer

Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are io.socket.emitter.Emitter$Listener

Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are io.socket.emitter.Emitter$Listener

Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are io.reactivex.FlowableOnSubscribe

Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are io.socket.emitter.Emitter$Listener

Error:Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are io.socket.emitter.Emitter$Listener

Error:Execution failed 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'
}

Following sequence works.

  1. Change minSdkVersion to 25. Sync and make project.
  2. Change minSdkVersion to 15 again. Sync and make project.

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

coder
  • 41
  • 1
  • 7

2 Answers2

0

It has to do with android-gradle support. you may have to use a new version of android gradle plugin but as of now it's a bit tricky.

I solved the same issue by 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 alone is not enough, an environment variable is also required (because it's an alpha version), see this answer

ApriOri
  • 2,618
  • 29
  • 48
0

Change your gradle android to this:

classpath 'com.android.tools.build:gradle:2.4.0-'
n4m31ess_c0d3r
  • 3,028
  • 5
  • 26
  • 35