Anyone know steps to replace frameworks.jar and relevant libraries on Android Marshmallow device?
My work is to modify Android Marshmallow framework source code, do full
Assuming you're modifying things under frameworks/base/, as it's where framework.jar
comes from, the steps I use are:
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.
Go to <aosp-root>/out/target/product/<product-name>/system/framework/
directory and get framework.jar
and services.jar
items.
Go to <aosp-root>/out/target/product/<product-name>/system/lib/
directory and get any libandroid*.so
file.
With device already rooted, adb push *.jar /system/framework/.
adb push *.so /system/lib/.
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.
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 applicationsservices.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.