How to get class files or Dalvik byte code of standard java libraries that are used by Dalvik VM?

StackOverflow https://stackoverflow.com/questions/18224029

I want to get the Dalvik bytecode for standard Java libraries, I mean, java libraries that are utilized by Android (e.g. java.util.* collections).

I need to get those class files because I want to analyze them, not all of them, but something like java.util.*, java.lang.*, etc.

However, when compiling any Android applications, no class files of those standard libraries would be generated, except for the application code and dependencies libraries.

So I'm wondering how to get the compiled class files (and its corespondent dex files when compiling in Dalvik VM)?

I tried to pull the standard Java libraries in an Android project, like get all the Java source code and add them as application code, OR put the classes.jar (rt.jar) in the libs folder, however, these two ways are not working because the source code or jar file in project will be in conflict with the default compilation environment and so give out dreaded error Conversion to Dalvik format failed with error 1

Any idea how to get what I want?

有帮助吗?

解决方案

The sources and the binaries of the system libraries are available as part of the Android SDK. Just look into the install directory platforms/android-{version}/android.jar for the binaries and sources/android-{version} for the sources (if you installed it).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top