actionscript-3airane

Why is Android Studio / Eclipse necessary to build an ANE?


I have used the following process to create a Java-based ANE for Android.

  1. Compile the java files along with their dependencies for Android platform.
  2. Create the .jar file with the Java SDK.
  3. Create the .swc file.
  4. Package the ANE using ADT.

When I use that ANE to package an APK, I get the following error:

dx tool failed:Compilation failed with an internal error. java.lang.IllegalArgumentException at com.android.tools.r8.org.objectweb.asm.ClassReader.<init>(ClassReader .java:160) at com.android.tools.r8.org.objectweb.asm.ClassReader.<init>(ClassReader .java:143) at com.android.tools.r8.org.objectweb.asm.ClassReader.<init>(ClassReader .java:418) at com.android.tools.r8.graph.JarClassFileReader.read(JarClassFileReader .java:91) at com.android.tools.r8.dex.ApplicationReader$ClassReader.lambda$readCla ssSources$1(ApplicationReader.java:231) at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(Unknown Source ) at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source) at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)

I know I have not followed the conventional route of using the Android Studio or Eclipse, or some such IDE. I just used the command prompt to achieve building the ANE.

What am I missing here? Is there something specific that Android Studio does before it outputs a .jar file that is packaged into an ANE?


Solution

  • Changed the release flag in javac to --release 8 and the APK is correctly created. Earlier, the release flag was set to 16.