You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Desugar Task should provide deps / --classpath_entry(s) #2143
desugar_deploy.jar desugaring .jar with dependencies without exception
Actual Behavior
Desugar entirely skips the --classpath_entry dependencies for .jar (or it's by design? please no) when desugar_deploy.jar gets called, causing failures just like:
1> Exception in thread "main" java.lang.TypeNotPresentException: Type okhttp3.Interceptor not present
changed the title [-]CompileToDalvikWithDx should provide deps / --classpath_entry(s) while desugaring[/-][+]Desugar Task should provide deps / --classpath_entry(s)[/+]on Sep 5, 2018
desugar_deploy.jar is deprecated as it was a standalone desugar tool that was integrated into the d8/r8 pipeline, and thus our initial support for desugar does not handle this scenario. We will need to ensure we are accounting for this within our r8 and d8 proposal.
At first glance, it looks like we would need to add this --classpath_entry switch and append the respective .jar file name foreach item. @jonathanpeppers can chime in further on this.
@erikpowa To be more specific, the desguar.jar is going to be deprecated in favor of the desugar step being included in the new dex compiler (d8). I don't believe the new dex compiler has an option to provide this argument. I'd defer to @jonathanpeppers whether he thinks it's worth to PR or not.
@jonathanpeppers sorry, I modified the Xamarin.Android.Build.Tasks.dll with dnSpy, I was lazy to clone/edit/build/push from source, and yes, my repro shows the current standalone desugar fails if there are certain jars that needs it's dependencies as classpath_entry, othwerwise it fails if not passed as argument. (such as twitter-core)
The hackish way looks like this (just make every --input --classpath_entry aswell):
@gmoney494 or you can make a custom desugar task on jar files that runs before Desugar task and try addig one of these arguments aswell (but it's untested)
Activity
[-]CompileToDalvikWithDx should provide deps / --classpath_entry(s) while desugaring[/-][+]Desugar Task should provide deps / --classpath_entry(s)[/+]JonDouglas commentedon Sep 5, 2018
desugar_deploy.jaris deprecated as it was a standalone desugar tool that was integrated into the d8/r8 pipeline, and thus our initial support for desugar does not handle this scenario. We will need to ensure we are accounting for this within ourr8andd8proposal.#2040
Our source for the desguar task can be found here:
https://github.com/xamarin/xamarin-android/blob/master/src/Xamarin.Android.Build.Tasks/Tasks/Desugar.cs
At first glance, it looks like we would need to add this
--classpath_entryswitch and append the respective .jar file name foreach item. @jonathanpeppers can chime in further on this.erikpowa commentedon Sep 5, 2018
I just patched the IL in here.

tested (with multidex) and it's working
Won't PR it then if it's deprecated
JonDouglas commentedon Sep 5, 2018
@erikpowa To be more specific, the
desguar.jaris going to be deprecated in favor of thedesugarstep being included in the new dex compiler (d8). I don't believe the new dex compiler has an option to provide this argument. I'd defer to @jonathanpeppers whether he thinks it's worth to PR or not.jonathanpeppers commentedon Sep 7, 2018
@erikpowa feel free to send a PR!
I'm trying to follow what you're changing here, but not seeing exactly. There isn't a variable named
textin ourDesugarMSBuild task.Are we missing jar files as
--input? https://github.com/xamarin/xamarin-android/blob/f6c3288dd5a7f82c178ef30ad25c11d475f1daf4/src/Xamarin.Android.Build.Tasks/Tasks/Desugar.cs#L85-L92Or do we need to specify
--classpath_entryfor each jar file in addition to--input?erikpowa commentedon Sep 7, 2018
@jonathanpeppers sorry, I modified the
Xamarin.Android.Build.Tasks.dllwith dnSpy, I was lazy to clone/edit/build/push from source, and yes, my repro shows the current standalone desugar fails if there are certain jars that needs it's dependencies as classpath_entry, othwerwise it fails if not passed as argument. (such as twitter-core)The hackish way looks like this (just make every --input --classpath_entry aswell):
gmoney494 commentedon Sep 11, 2018
@erikpowa another way to get past this error without modifiying the dll?
erikpowa commentedon Sep 11, 2018
@gmoney494 don't think so, you can build it XA manually tho, but it's only working >=7.0, something is messing around under api 24
erikpowa commentedon Sep 11, 2018
@gmoney494 or you can make a custom desugar task on jar files that runs before
Desugartask and try addig one of these arguments aswell (but it's untested)Added --classpath_entry for Desugar (#2158)