zoukankan      html  css  js  c++  java
  • android studio# jdk8# class file for java.lang.invoke.MethodType not found

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

     

    class file for java.lang.invoke.MethodType not found #23

     Closed
    dziobas opened this issue on Jun 23, 2014 · 10 comments
     

    5 participants

    @dziobas@evant@paulvi@hanibalsk@mgrzechocinski
    @dziobas

    I tried to setup new sample project and it can't compile.

    An exception has occurred in the compiler (1.8.0_05). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
    com.sun.tools.javac.code.Symbol$CompletionFailure: class file for java.lang.invoke.MethodType not found
    
    * Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugJava'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) 
    .
    .
    .
    Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.
        at org.gradle.api.internal.tasks.compile.jdk6.Jdk6JavaCompiler.execute(Jdk6JavaCompiler.java:47)
        at org.gradle.api.internal.tasks.compile.jdk6.Jdk6JavaCompiler.execute(Jdk6JavaCompiler.java:38)
        at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:96)
        at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:49)
        at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:35)
        at org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler.execute(DelegatingJavaCompiler.java:29)
        at org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler.execute(DelegatingJavaCompiler.java:20)
        at org.gradle.api.internal.tasks.compile.IncrementalJavaCompilerSupport.execute(IncrementalJavaCompilerSupport.java:33)
        at org.gradle.api.internal.tasks.compile.IncrementalJavaCompilerSupport.execute(IncrementalJavaCompilerSupport.java:24)
        at org.gradle.api.tasks.compile.Compile.compile(Compile.java:67)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
        ... 72 more
    

    Setup is similar as in the doc except:

    retrolambda {
        jdk System.getenv("JAVA8_HOME")
        oldJdk System.getenv("JAVA7_HOME")
        javaVersion JavaVersion.VERSION_1_7
    }
    

    Environment variables are set to:
    /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home
    /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
    respectively.

    @evant
    Owner

    I'm having trouble repoducing your issue. I have a few questions that may narrow it down.

    What version of java are you using to run gradle? (java -version or echo $JAVA_HOME)
    What version of OSX are you running?
    Could you post your whole build.gradle so I can see if there are any other difference I can check?

    @dziobas
    java -version
    java version "1.8.0_05"
    Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
    

    build.gradle

    repositories {
        mavenCentral()
    }
    
    buildscript {
        repositories {
            mavenCentral()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:0.11.+'
            classpath 'me.tatarka:gradle-retrolambda:1.3.2'
    
        }
    }
    
    apply plugin: 'retrolambda'
    apply plugin: 'android'
    
    
    android {
        compileSdkVersion 19
        buildToolsVersion "19.1.0"
    
        defaultConfig {
            applicationId "com.testproject.lambdasandbox"
            minSdkVersion 10
            targetSdkVersion 19
            versionCode 1
            versionName "1.0"
        }
        buildTypes {
            release {
                runProguard false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    
    
    retrolambda {
        jdk System.getenv("JAVA8_HOME")
        oldJdk System.getenv("JAVA7_HOME")
        javaVersion JavaVersion.VERSION_1_7
    }
    
    dependencies {
        repositories {
            mavenCentral()
        }
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:19.+'
        // Latest one on maven central
       //  retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:1.+'
    }
    
    ./gradlew --version
    
    ------------------------------------------------------------
    Gradle 1.10
    ------------------------------------------------------------
    
    Build time:   2013-12-17 09:28:15 UTC
    Build number: none
    Revision:     36ced393628875ff15575fa03d16c1349ffe8bb6
    
    Groovy:       1.8.6
    Ant:          Apache Ant(TM) version 1.9.2 compiled on July 8 2013
    Ivy:          2.2.0
    JVM:          1.8.0_05 (Oracle Corporation 25.5-b02)
    OS:           Mac OS X 10.9.3 x86_64
    
    @evant
    Owner
     
    解决方法在这里

    Try swapping apply plugin: 'retrolambda' and apply plugin: "android"

    @dziobas

    That was it, thank you!

    @dziobasdziobas closed this on Jun 24, 2014
  • 相关阅读:
    windows 2008 64位在指定的 DSN 中,驱动程序和应用程序之间的体系结构不匹配
    uva 11552 dp
    A*搜索算法
    Dalvik虚拟机总结
    J2SE基础:5.面向对象的特性2
    Linux/Android——input_handler之evdev (四)【转】
    Linux/Android——input子系统核心 (三)【转】
    Linux/Android——输入子系统input_event传递 (二)【转】
    【Android】Android输入子系统【转】
    Linux/Android——usb触摸屏驱动
  • 原文地址:https://www.cnblogs.com/wanqieddy/p/4487016.html
Copyright © 2011-2022 走看看