The android dev site documentation for java.lang.Package is a close copy of the Java Platform SE 8 docs, but the behavior at runtime is very different for libraries loaded from a jar.
I have checked a handful of the versioning attributes documented in https://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html#Main_Attributes (ImplementationVersion, ImplementationVendor, SpecificationTitle) and all of them return the correct data from the Manifest when running with the openjdk JRE on my desktop, but well-formed but incorrect data on the platform.
import com.example.roscoe.Roscoe;
public class Hello {
public static void main(String[] argv) {
Package p = Roscoe.class.getPackage();
System.out.println(p.getName());
System.out.println(p.getImplementationVersion());
}
}
Is there anything I can do at the 'converting jar into dex' stage of compilation to cause the manifest data to be available at runtime?
Edit to add:
Why does this even matter First, I'm a prescriptivist and it is documented to work, so it should work.
Second, we are at a stage where no two testers have the same version of a fast-moving library and we really want to have the library version in the About Box for the application.