gradle-retrolambda
gradle-retrolambda copied to clipboard
cannot find java.lang.invoke.MethodType
com.sun.tools.javac.code.Symbol$CompletionFailure: 找不到java.lang.invoke.MethodType的类文件 Error:Execution failed for task ':app:compileDebugUnitTestJavaWithJavac'.
Compilation failed; see the compiler error output for details.
code in my build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'me.tatarka:gradle-retrolambda:3.2.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
//---------------------------------------------------//
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.gugoo.nothisboy.dessert"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dataBinding {
enabled true
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.jakewharton:butterknife:7.0.0'
compile 'homhomlin.lib:frescoimageview:1.3.0'
compile 'com.facebook.fresco:fresco:0.9.0'
//rxjava rxandroid
compile 'io.reactivex:rxjava:1.1.6'
compile 'io.reactivex:rxandroid:1.2.1'
//rxbinding
compile 'com.jakewharton.rxbinding:rxbinding:0.4.0'
compile 'com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0'
compile 'com.jakewharton.rxbinding:rxbinding-appcompat-v7:0.4.0'
compile 'com.jakewharton.rxbinding:rxbinding-design:0.4.0'
compile 'com.jakewharton.rxbinding:rxbinding-recyclerview-v7:0.4.0'
//rxsqlite
compile 'com.pushtorefresh.storio:sqlite:1.9.0'
compile 'com.pushtorefresh.storio:sqlite-annotations:1.9.0'
//rxlifecycle
compile 'com.trello:rxlifecycle:0.6.1'
//rx other
compile 'com.hwangjr.rxbus:rxbus:1.0.3'
compile 'com.marlonmafra.rxnotification:rx-notification:2.0.0'
compile 'com.f2prateek.rx.preferences:rx-preferences:1.0.2'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
//unit test
testCompile 'junit:junit:4.12'
testCompile "org.mockito:mockito-core:1.10.19"
testCompile 'org.robolectric:robolectric:3.0'
}
How to resolve this problem? I need help,please.
You don't mention what OS you're on but I'm assuming windows. I've seen this error on a bunch of projects but only when building via gradlew from the windows command line. Works fine on linux.
I don't know what the direct issue is but I can offer a solution: Run the gradle build in a daemon. I don't knwo why, but it works.
org.gradle.daemon=true
(Best in your global gradle.properties file.)
Note that fixing this error will most likely cause some noisy warnings:
java.lang.UnsupportedOperationException: Unknown ASTNode child: LambdaExpression
at lombok.ast.ecj.EcjTreeVisitor.visitOther(EcjTreeVisitor.java:368)
The fix for this one's easy though, just add this to the buildscript dependencies:
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
i have this problem in mac os
I encountered this when I didn't have JAVA7_HOME and JAVA8_HOME env variables configured.