Some of the new Android libraries use Java 8 features. Android doesn't natively support those features so they must be removed (desugared) at some point.
When you wrap a library that includes such features you need to desugar the wrapped library. This is done with an Android tool named desugar.
It can be downloaded from here: www.b4x.com/android/files/Desugar_deploy.jar
This input of this tool is a jar file and the output is a "desugared" jar. You need to do it once and then use the desugared jar.
The latest version of ExoPlayer depends on 7 AAR packages. Desugaring these packages requires several steps:
- Extract the inner classes.jar from each AAR.
- Desugar it.
- Put it back or remove the original one.
To make things easier I wrote a small B4J app that does the following steps:
- Extracts all classes.jar and merges them to a single jar.
- The classes.jar files are removed from the AAR files.
- The merged jar is desugared.
Go over the code before you use it.
Note that it calls zip info: http://infozip.sourceforge.net/Zip.html#Release
zip.exe is available here: https://www.b4x.com/android/forum/t...r-merged-jar-is-not-a-val.111005/#post-693285
If the classes.jar depend on other libraries then you will need to add references by adding additional --bootclasspath_entry parameters.
When you wrap a library that includes such features you need to desugar the wrapped library. This is done with an Android tool named desugar.
It can be downloaded from here: www.b4x.com/android/files/Desugar_deploy.jar
This input of this tool is a jar file and the output is a "desugared" jar. You need to do it once and then use the desugared jar.
The latest version of ExoPlayer depends on 7 AAR packages. Desugaring these packages requires several steps:
- Extract the inner classes.jar from each AAR.
- Desugar it.
- Put it back or remove the original one.
To make things easier I wrote a small B4J app that does the following steps:
- Extracts all classes.jar and merges them to a single jar.
- The classes.jar files are removed from the AAR files.
- The merged jar is desugared.
Go over the code before you use it.
Note that it calls zip info: http://infozip.sourceforge.net/Zip.html#Release
zip.exe is available here: https://www.b4x.com/android/forum/t...r-merged-jar-is-not-a-val.111005/#post-693285
If the classes.jar depend on other libraries then you will need to add references by adding additional --bootclasspath_entry parameters.
Attachments
Last edited: