Replace only framework.jar & its relevant libraries on Android MarshMallow

我怕爱的太早我们不能终老 提交于 2019-12-05 01:29:52

Assuming you're modifying things under frameworks/base/, as it's where framework.jar comes from, the steps I use are:

  1. If you already have a full-build, use mm command in the directory where you're modifying any code. It's faster than mmm since it doesn't compile framework dependencies again.

  2. Go to <aosp-root>/out/target/product/<product-name>/system/framework/ directory and get framework.jar and services.jar items.

  3. Go to <aosp-root>/out/target/product/<product-name>/system/lib/ directory and get any libandroid*.so file.

  4. With device already rooted, adb push *.jar /system/framework/.

  5. adb push *.so /system/lib/.

  6. Factory reset the device and reboot it.

Changes made on your framework might work now. If your target device is 64 bits, replace lib by lib64 on above destinations.

Explanation

Above steps will vary according to what we modify inside AOSP framework. Here a quick description on what goes inside each file:

  • framework.jar: APIs accessible to applications
  • services.jar: Implementation of managers and system services located under frameworks/base/services.
  • libandroid*.so: Libraries generated from native code (C/C++) like the .cpp files located at frameworks/base/core/jni.

But, in general, each Android.mk inside frameworks will generate at least one output named by the LOCAL_MODULE variable and the type of the module depends on the following include instruction:

# JAR file
include $(BUILD_JAVA_LIBRARY)

# Library to be used by other modules
include $(BUILD_SHARED_LIBRARY)

# Executables
include $(BUILD_EXECUTABLE)

For example, the frameworks/base/cmds folder generates a Java library and an executable for each item inside it, like the pm command commonly used to install apps via ADB. In any case, the rule is: Java libraries go to /system/framework/, Shared libraries go to /system/lib/ and executables go to /system/bin.

More official information about Android.mk can be found here, but it doesn't cover all variables and macros used by Android Build System, I get most of that info from AOSP code itself.

Hope it helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!