androidexoplayerretrolambda

Problem with adding exoplayer and turning on java 8


i am using realm and retrolambda, i want to add exoplayer to my project and it requires java 8 support, when i add compile options java 8 and i rebuild project, i get this error :

Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add 
`targetCompatibility` = '1.7'
`sourceCompatibility` = '1.7'
to that `submodule's build.gradle` file.

i created a test project and i added exoplayer and when i added compile options java 8 i also added jackoption and it worked without any problem,but in my project i have retrolambda that does not allow me to add jack option,what can i do for this?


Solution

  • after 1 day of searching and reading doucuments, i found my own solution,my gradle plugin is lower than 3.0.0 and for turning on java 8 in this gradle plugin,i needed to add jacOptionto my gradle.build that it has problem with retrolamda so we can not turn on java 8 and retrolamda withtogether in gradle plugin version lower than 3.0.0 , if retrolambda is not necesery in your project , you can remove it , if you can not,there is a solution, jackOption is deprecated in new gradle plugin versions , you can update your gradle plugin to 3.0.0 or higher (that reqires IDE version 3 or higher) after that, you can turn on java 8 and add retrolambda without any problem