Describe your issue
I've already read #185 and I put 26 as the minSDKversion so my kotlin project could use Javalin, but when I try to build my android app I get this error:
Execution failed for task ':app:mergeDebugJavaResource'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
More than one file was found with OS independent path 'org/eclipse/jetty/http/encoding.properties'.
Is there a way to avoid this problem? (except using javalin-without-jetty)
This is happening to me as well, but check the exception it throws when transforming the library.
You are probably using desugaring to convert Java 8 libraries in Java 7.
For some reason Android Studio hides those exceptions, which is counter intuitive. To view them scroll up in the "build output" and find the lines that say something like "Transform artifact jetty-servlet-9.4.29.v20200521.jar (org.eclipse.jetty:jetty-servlet:9.4.29.v20200521) with DexingNoClasspathTransform". you will see a greyed out text saying "<1 internal call>", if you click on it you will see the exception.

In my case it throws the same error, but if I scroll up it says that it couldn't transform the library because it's not supported in my SDK version.
Sadly in my case I'm starting to give up about using Javalin, since I can't switch my minSDK to be higher than 25 and I can't find a solution to add compatibility.
Transform artifact jetty-servlet-9.4.29.v20200521.jar (org.eclipse.jetty:jetty-servlet:9.4.29.v20200521) with DexingNoClasspathTransform:
AGPBI: {"kind":"error","text":"MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)
Stack trace:
com.android.tools.r8.errors.a: MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)
at com.android.tools.r8.errors.a.a(:7)
at com.android.tools.r8.ir.conversion.O.b(:58)
at com.android.tools.r8.ir.conversion.O.a(:104)
at com.android.tools.r8.ir.conversion.O.a(:53)
at com.android.tools.r8.graph.C.b(:43)
at com.android.tools.r8.ir.conversion.O.b(:35)
at com.android.tools.r8.utils.S0.a(:10)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:322)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:66)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:36)
at com.android.tools.r8.utils.S0.a(:3)
at com.android.tools.r8.ir.conversion.O.a(:10)
at com.android.tools.r8.D8.d(:29)
at com.android.tools.r8.D8.b(:1)
at com.android.tools.r8.utils.W.a(:30)
at com.android.tools.r8.D8.run(:11)
at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:116)
... a lot more lines ...
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.lang.Thread.run(Thread.java:748)
Suppressed: java.util.concurrent.ExecutionException: com.android.tools.r8.errors.a: MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:552)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:513)
at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:86)
at com.android.tools.r8.utils.S0.a(:14)
at com.android.tools.r8.utils.S0.a(:9)
... 121 more
[CIRCULAR REFERENCE:com.android.tools.r8.errors.a: MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)]
Caused by: com.android.tools.r8.a: MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)
at com.android.tools.r8.ir.conversion.N.a(:633)
at com.android.tools.r8.ir.conversion.N.a(:674)
at com.android.tools.r8.r.n.A.a(:236)
at com.android.tools.r8.ir.conversion.o.a(:153)
at com.android.tools.r8.ir.conversion.N.a(:133)
at com.android.tools.r8.graph.l.a(:93)
at com.android.tools.r8.graph.l.a(:71)
at com.android.tools.r8.graph.l.buildIR(:1)
at com.android.tools.r8.graph.C0.buildIR(:1)
at com.android.tools.r8.graph.T.a(:152)
at com.android.tools.r8.ir.conversion.O.a(:412)
at com.android.tools.r8.ir.conversion.O.b(:53)
... 134 more
","sources":[{"file":"C:\Users\JavierCasa\.gradle\caches\transforms-2\files-2.1\b808f653ebc605ccf0f3fee6f2482f93\jetified-jetty-servlet-9.4.29.v20200521.jar"}],"tool":"D8"}
I did not find these lines in the build output, but I ran the build with --stacktrace and here's the full log: https://pastebin.com/MQRRiMVy
I'm dumb, I just needed to place
packagingOptions {
exclude 'org/eclipse/jetty/http/encoding.properties'
}
in the android block of my build.gradle.
Now I can close this issue!
It would be useful to document this, perhaps even on the main README.md, since anyone intending to add this to an Android project will encounter this issue, including myself.
That's a good idea, but isn't org.eclipse.jetty.http.encoding.properties needed for something?
I mean if this is related to encoding, it could be required for something in the library?
In my case i didn't have to use encoding in my project but the library could break when using it...
You can do “pickFirst” or even “merge” instead if you want to keep the
file. But they are both identical (the original in jetty-http and in
javalin).
On Sat, Aug 15, 2020 at 2:43 PM Username404-59 notifications@github.com
wrote:
>
>
That's a good idea, but isn't org.eclipse.jetty.http.encoding.properties
needed for something?I mean if this is related to encoding, it could be required for something
in the library?In my case i didn't have to use encoding in my project but the library
could break...—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tipsy/javalin/issues/1023#issuecomment-674450052, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/ACSMXR2XNBPBJ45MTYBYEVLSA36ONANCNFSM4OIV42LQ
.