Comments (15)
My solution for it.
String java8 = getJavaVersion(8)
String java7 = getJavaVersion(7)
retrolambda {
jdk java8 //have tried with JAVA8_HOME
oldJdk java7 //have tried with JAVA6_HOME
javaVersion JavaVersion.VERSION_1_7 //have matched the above with VERSION_1_6
}
String getJavaVersion(Integer v) {
def sout = new StringBuffer()
def proc = "/usr/libexec/java_home -v 1.$v".execute()
proc.consumeProcessOutput(sout, new StringBuffer())
proc.waitForOrKill(1000)
return sout.toString().replace("\n", "").replace("\r", "")
}
from gradle-retrolambda.
I found a workaround by going to Android Studio -> Preferences -> Path Variables and adding
JAVA_8 /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
from gradle-retrolambda.
Unfortunately this didn't fix the above error for me. Any other steps you may have done?
Android Studio 0.9.2, Gradle 2.1, OSX
retrolambda {
jdk System.getenv("JAVA_8") //have tried with JAVA8_HOME
oldJdk System.getenv("JAVA7_HOME") //have tried with JAVA6_HOME
javaVersion JavaVersion.VERSION_1_7 //have matched the above with VERSION_1_6
jvmArgs '-arg1', '-arg2'
}
Same error
Error:Execution failed for task ':proj:patchAndroidJar'.
> Retrolambda: null/jre/lib/rt.jar does not exist, make sure that the environment variable JAVA_HOME or JAVA8_HOME, or the gradle property retrolambda.jdk points to a valid version of java8.
from gradle-retrolambda.
Below is my current, ugly-hardcoded, solution :(
retrolambda {
jdk '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home'//System.getenv("JAVA_8")
oldJdk System.getenv("JAVA7_HOME")
javaVersion JavaVersion.VERSION_1_7
}
from gradle-retrolambda.
Please check this if it is helpful: http://stackoverflow.com/a/27795843/1592410
from gradle-retrolambda.
On OSX we had to use @stepango 's VERY CREATIVE workaround. Thanks for your snippet, it just ended an hour of nonsense for us. This is pretty crazy! Tried setting environment variables every way under the sun and couldn't get anything working. Tried the .bashrc the .bash_profile the /etc/profile the .profile , Path Variables in Android Studio etc. Seems like it shouldn't be this hard.
from gradle-retrolambda.
Ditto: On OSX we had to use @stepango 's VERY CREATIVE workaround.
THANK YOU!! This is also preferable to us as we want to have Jenkins CI automated builds, and this workaround only requires that one install JDK8 before utilizing. Very modular. :D
from gradle-retrolambda.
Thanks @stepango, worked for us!
from gradle-retrolambda.
I have another work around for this issue, that might be helpful. We couldn't use @stepango workaround as our projects has a variety of development machines and a CI server. Our solution uses a gradle.properties file and is outlined in this blog post:
http://andersmurphy.com/2015/09/16/setting-up-retrolambda/
Hope that helps.
from gradle-retrolambda.
@andersmurphy The guide you provided worked great! Thank you for the hard work.
Wanted to make a simple suggestion.
Maybe make the following part a bit more clear as it can be confusing for some users:
"Note: If you are building your project with Java 8 you only need to add oldJdk JAVA7_HOME. If you are building your project with Java 7 you only need to add jdk JAVA8_HOME."
Thanks again and keep up the wonderful work.
from gradle-retrolambda.
@Mithrandir21 Good to hear it worked for you and thanks for the feedback. I'll try and clear that confusing section up.
from gradle-retrolambda.
@andersmurphy Thanks buddy... looks like this is the only thing that works with macosx :(
Thanks again 👍
from gradle-retrolambda.
thanks so much~~!
from gradle-retrolambda.
Editing /etc/environment as follows and rebooting Ubuntu made it work for me. Otherwise Gradle wouldn't pick up the environment variables, not sure why.
$ cat /etc/environment
JAVA_HOME=/usr/lib/jvm/java-8-oracle
JAVA7_HOME=/usr/lib/jvm/java-7-oracle
JAVA8_HOME=/usr/lib/jvm/java-8-oracle
from gradle-retrolambda.
@stepango worked for me thanks!
from gradle-retrolambda.
Related Issues (20)
- The project can't start When I add jackOptions.enabled = true to defaultConfig?
- cannot find symbol method metafactory HOT 2
- Gradle warning for use of deprecated method getClassesDir HOT 1
- NoClassDefFoundError for Lamba expressions: java.lang.NoClassDefFoundError: com.example.sanuja.foodrunner.util.SharedPrefsUtil$$Lambda$1 HOT 1
- AlertDialog OnClickListener not triggered HOT 2
- Apply retrolambda to custom JavaCompile tasks HOT 4
- Provide option to remove "-javaagent" argument passing to retrolambda HOT 1
- App:compileRetrolambdaDebug
- app:transformClassesWithRetrolambdaForDebug HOT 3
- The CompileOptions.bootClasspath property has been deprecated HOT 2
- DexArchiveBuilderException: Failed to process ...\rxbinding-2.2.0.aar\.. HOT 2
- Error "Failed to notifiy project evaluation listener" in Gradle 5 HOT 2
- Not compatible with Gradle 5.1 HOT 7
- 😱ERROR:java.lang.NoSuchFieldError: method resolution failed
- javaVersion don't support HOT 1
- Can I use retrolambda after end of 2019? HOT 2
- NoSuchMethodError? HOT 1
- Unsupport the jar with java8 HOT 1
- The classes in the dependencies aar seems not to be converted HOT 1
- Incompatible with Gradle 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gradle-retrolambda.