After compiled a simple test and created the .jar file using Java 17, knowing Android 14 SDK (API 34) is based on Java 17 , I tried to compile with Android sdk d8.bat utility to obtain a .dex file with this command since they are same Java version for compatibility:
C:\path-to-project>C:\...\Android\Sdk\build-tools\34.0.0\d8.bat --release --output C:\path-to-project\target --lib "C:\Program Files\Android\Android Studio\plugins\android\lib\android.jar" C:\path-to-project\target\myproject.jar
but I obtain this compilation error :
Warning in C:\path-to-project\target\myproject.jar:org/springframework/boot/loader/net/protocol/nested/NestedLocation.class at Lorg/springframework/boot/loader/net/protocol/nested/NestedLocation;create(ILjava/lang/String;)Lorg/springframework/boot/loader/net/protocol/nested/NestedLocation;:
Type `java.nio.file.Path` was not found, it is required for default or static interface methods desugaring of `Lorg/springframework/boot/loader/net/protocol/nested/NestedLocation;create(ILjava/lang/String;)Lorg/springframework/boot/loader/net/protocol/nested/NestedLocation;`
Error in C:\path-to-project\target\myproject.jar:org/springframework/boot/loader/jar/NestedJarFileResources.class at Lorg/springframework/boot/loader/jar/NestedJarFileResources;addToExceptionChain(Ljava/io/IOException;Ljava/io/IOException;)Ljava/io/IOException;:
com.android.tools.r8.internal.Sb: Class or interface java.io.IOException required for desugaring of try-with-resources is not found.
Compilation failed
Exception in thread "main" java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: Lorg/springframework/boot/loader/jar/NestedJarFileResources;addToExceptionChain(Ljava/io/IOException;Ljava/io/IOException;)Ljava/io/IOException;, origin: C:\path-to-project\target\myproject.jar:org/springframework/boot/loader/jar/NestedJarFileResources.class
at com.android.tools.r8.utils.R0.a(R8_8.2.2-dev_53a55043254cc5be8ef500331bba25d1b4ca4bc2cd66c555d4358bf672a1f10a:126)
at com.android.tools.r8.D8.main(R8_8.2.2-dev_53a55043254cc5be8ef500331bba25d1b4ca4bc2cd66c555d4358bf672a1f10a:5)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: Lorg/springframework/boot/loader/jar/NestedJarFileResources;addToExceptionChain(Ljava/io/IOException;Ljava/io/IOException;)Ljava/io/IOException;, origin: C:\path-to-project\target\myproject.jar:org/springframework/boot/loader/jar/NestedJarFileResources.class
and it looks related to this java.nio.file.Path which doesn’t allow or just fails on desugaring in some spring framework jar file… do you know maybe what’s related to con compiling that vaadin flow project?
Thanks in advance!
Cheers!