Android Jack: Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are java.util.function.Consumer

后端 未结 4 930
没有蜡笔的小新
没有蜡笔的小新 2020-12-31 04:22

Getting this on android studio 2.2.

Does anyone have a workaround?

My app build file is:

apply plugin: \'com.android.application\'

android {         


        
相关标签:
4条回答
  • 2020-12-31 04:33

    I had this problem after adding Guava library to my dependencies.

    Solution was to downgrade lib version from com.google.guava:guava:21.0 to com.google.guava:guava:20.0.

    Also, I'm using classpath 'com.android.tools.build:gradle:2.5.0-alpha-preview-01`

    EDIT: As you don't use this library please try to change:

    • in project build.gradle
      • classpath from classpath 'com.android.tools.build:gradle:2.2.0' to com.android.tools.build:gradle:2.5.0-alpha-preview-01
    • in app build.gradle

      • from compileSdkVersion 24 to 25
      • from buildToolsVersion "24.0.2"to 25.0.2
    • in gradle-wrapper.properties

      • change version to distributionUrl=https://services.gradle.org/distributions-snapshots/gradle-3.5-20170213202653+0000-all.zip
    0 讨论(0)
  • 2020-12-31 04:36

    upgrading android studio, the following seems to work (but it's really slow now):

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 25
        buildToolsVersion "25.0.0"
    
        defaultConfig {
            applicationId "acme.cb2"
            minSdkVersion 22
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
            jackOptions {
                enabled true
           }
        }
        dexOptions {
            //javaMaxHeapSize "4G"
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:25.2.0'
        compile 'com.android.support:support-v4:25.2.0'
    }
    
    0 讨论(0)
  • 2020-12-31 04:40

    add this in your build.gradle:

    allprojects {
        repositories {
            jcenter()
        }
        gradle.projectsEvaluated {
            tasks.withType(JavaCompile) {
                options.compilerArgs << "-Xbootclasspath/a:" + System.properties.get("java.home") + "/lib/rt.jar"
            }
        }
    }
    
    0 讨论(0)
  • 2020-12-31 04:48

    Try

    classpath 'com.android.tools.build:gradle:2.3.+'
    

    and

    minSdkVersion 25
    
    0 讨论(0)
提交回复
热议问题