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

Labels

None yet

Milestone

No milestone

Assignee

No one assigned

Notifications

Subscribe

You‘re not receiving notifications from this thread.

5 participants

dziobas commented on Jun 23, 2014

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.

Owner

evant commented on Jun 23, 2014

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 commented on Jun 23, 2014

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

Owner

evant commented on Jun 24, 2014

解决方法在这里

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

dziobas commented on Jun 24, 2014

That was it, thank you!

dziobas closed this on Jun 24, 2014

时间: 2024-11-11 11:43:33

android studio# jdk8# class file for java.lang.invoke.MethodType not found的相关文章

Android Studio 首次安装报错 Java.lang.RuntimeException:java.lang.NullPointerException...错

下次安装报:Java.lang.RuntimeException: java.lang.NullPointerException......错 只需在文件..\Android Studio\bin\idea.properties(需要对应自己的安装目录下)最后面加一行代码:disable.android.first.run=true  就可以完美解决问题了

Android Studo 使用 JNI报错:java.lang.UnsatisfiedLinkError: Couldn't load XXX from loader dalvik.system.PathClassLoader

今天在使用Android Studio的时候突然发现代码没错,so包也引入了,各个版本都引入了,但是就是一直报错: java.lang.UnsatisfiedLinkError: Couldn't load serphone from loader dalvik.system.PathClassLoader 11-30 11:13:18.766 29255-29255/com.personal.tai.ronglianim E/AndroidRuntime: at java.lang.Runti

The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object

The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object (2007-08-29 10:13:56) 转载▼ 错误提示:The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object

jdk7之java.lang.invoke.MethodHandle

在应用中,我们使用java反射的场景也不是很多,但偶尔也会用用.框架用反射用的比较多,例如mybatis.spring等. 在JDK7中,新增了java.lang.invoke.MethodHandle,称之为"现代化反射". 其实反射和java.lang.invoke.MethodHandle都是间接调用方法的途径,但java.lang.invoke.MethodHandle比反射更简洁,用反射功能会写一大堆冗余代码. 官方api给出的解释: A method handle is a

Android Studio NDK 学习之接受Java传入的字符串

本博客是基于Android Studio 1.3 preview版本,且默认你已经安装了Android SDK, Android NDK. 用Android Studio新建一个工程叫Prompt,其目录结构如下: ├── Prompt.iml ├── app │   ├── app.iml │   ├── build │   ├── build.gradle │   ├── libs │   ├── proguard-rules.pro │   └── src ├── build │   └─

Android集成银联支付,提示java.lang.UnsatisfieldLinkError错误

尽管解决方法很简单,但还是记录一下吧. 最近做银联支付(Android),官方给的demo是eclipse的.按照官方(https://open.unionpay.com/ajweb/product)给的步骤,在Android studio中一步一步集成.运行出错,提示 java.lang.UnsatisfieldLinkError: Couldn't load entryexpro from loader dalvik.system.PathClassLoader... 官方文档中也提到了这个

Android Studio NDK 学习之接受Java传入的Int数组

本博客是基于Android Studio 1.3 preview版本,且默认你已经安装了Android SDK, Android NDK. 用Android Studio新建一个工程叫AndroidJNI_IntArray,其目录结构如下: ├── AndroidJNI_IntArray.iml ├── app │   ├── app.iml │   ├── build │   ├── build.gradle │   ├── libs │   ├── proguard-rules.pro │ 

我的Android进阶之旅------>Android中MediaRecorder.stop()报错 java.lang.RuntimeException: stop failed.

今天在调用MediaRecorder.stop(),报错了,java.lang.RuntimeException: stop failed. E/AndroidRuntime(7698): Cause by: java.lang.RuntimeException: stop failed. E/AndroidRuntime(7698): at android.media.MediaRecorder.stop(Native Method) E/AndroidRuntime(7698): at co

android布局太深导致的 java.lang.StackOverflowError

E/AndroidRuntime( 1900): java.lang.StackOverflowError E/AndroidRuntime( 1900):     at android.graphics.Canvas.drawText(Canvas.java:1269) E/AndroidRuntime( 1900):     at android.text.Layout.draw(Layout.java:337) E/AndroidRuntime( 1900):     at android