How to create an Android SDK source to get Android.jar

I am not an Android expert, but I need to use the Android-SDK byte code for some experiments.

I compiled the source of Androids, but it is surprising that it outputs the same SDK, which basically contains lame stubs that throw exceptions.

As you know, the android.jar file, which is included in the development package, contains stubs, and all methods in all classes just throw a new RuntimeException ("stub"); The purpose of this SDK is only to allow developers to create against android.jar in Eclipse and run their programs on devices / emulators where the actual SDK is located.

I separated java files from the Android source for the SDK, but I did not manage to compile them. I was wondering if there is a way to do this or retrieve them from devices. My ultimate goal is to sort Android applications on regular JVMs and run them on an emulator or Dalvik.

+4
source share
2 answers

you cannot run android.jar code on the JVM. As you said in your question, you will get a runtime exception if you do. This is by design, so you get all the syntax and refactoring tools from a popular Java environment like eclipse.

0
source

android.jar is for Eclipse only, as said. if we make some changes to the Framework and try to use the same buildroid.jar file, it will compile in order. but it will have runtime errors as you need to update system.img which has all lib and jar files at runtime. replace system.img with the costume assembly. he will work.

0
source

Source: https://habr.com/ru/post/1416231/


All Articles