I was looking at how extensions were crafted in AI when I saw that two jar files are being included in the .aix (and .aia as well) file: classes.jar and files/AndroidRuntime.jar. Well, actually it is not the first time I see them, but while checking appinventor-sources could not find any explanation to this: Why are both files included, when just classes.jar could be in there?
Checking the compiled sources of a few extensions, both .jar files contain the same classes (although in size they are not the same, there is a small difference).
So, my question is, what is the difference between both of them, and why both of them are needed?
classes.jar contains .class bytecode (used for compiling APK), while AndroidRuntime.jar contains .dex bytecode (used while running code on companion dynamically)
No, you should not remove AndroidRuntime.jar, your build will fail.
It's the opposite of what Pavi has written, classes.jar contains dex bytecode while AndroidRuntime.jar contains raw java classes.
If you want to optimize extension size, (by removing companion compatibility), then you should be looking to modify the classes.jar file and not the AndroidRuntime.jar.