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

前端 未结 1 1698
误落风尘
误落风尘 2021-02-20 11:28

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

1条回答
  •  一生所求
    2021-02-20 11:55

    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 /out/target/product//system/framework/ directory and get framework.jar and services.jar items.

    3. Go to /out/target/product//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.

    0 讨论(0)
提交回复
热议问题