仅替换framework.jar& Android MarshMallow上的相关库 [英] Replace only framework.jar & its relevant libraries on Android MarshMallow

查看:275
本文介绍了仅替换framework.jar& Android MarshMallow上的相关库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道在Android Marshmallow设备上替换frameworks.jar和相关库的步骤吗?

Anyone know steps to replace frameworks.jar and relevant libraries on Android Marshmallow device?

我的工作是修改Android Marshmallow框架源代码,然后进行全面构建更新到设备然后验证结果。每次大约需要1,2个小时。

My work is to modify Android Marshmallow framework source code, do full-build then update to device then verify result. It takes about 1,2 hours each time.

如果我这样做1,2,3次就可以,但实际上如果我的修改不起作用,我必须重复100次。但我只修改框架中的一小段代码/所以我认为如果我只能在Android代码中重建框架/模块并仅替换框架/部件在设备中,那将节省我很多时间。

It is OK if I do it 1,2,3 times but actually I had to repeat it even 100 times if my modification not work. But I only modify only a small piece of code in frameworks/ so I think it would save me much time if I can rebuild only frameworks/ module in Android code and replace only frameworks/ part in device.

我知道如何使用 mmm 来重建框架/模块。但我不知道如何替换框架/部分设备,因为只需替换framework.jar在Marshmallow案例中不起作用。

I know how to use mmm to rebuild just frameworks/ module. But I don' know how to replace frameworks/ part in device because just replace frameworks.jar not work in Marshmallow case.

推荐答案

假设您正在修改 frameworks / base / ,因为 framework.jar 来自哪里,我使用的步骤是:

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


  1. 如果您已经有完整版本,请在您要修改任何目录的目录中使用 mm 命令码。它比 mmm 更快,因为它不会再次编译框架依赖项。

  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.

转到< aosp-root> / out / target / product /< product-name> / system / framework / 目录并获取 framework.jar services.jar items。

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

转到< aosp-root> / out / target / product /< product-name> / system / lib / 目录并获取任何 libandroid * .so 文件。

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

设备已植根, adb push * .jar / system / framework /.

adb push * .so / system / lib /.

出厂重置设备并重新启动它。

Factory reset the device and reboot it.

对您的框架所做的更改可能在工作,在忙。如果目标设备是64位,则在上面的目标上用lib64替换lib。

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

以上步骤将根据我们在AOSP框架内修改的内容而有所不同。这里有一个关于每个文件内容的快速描述:

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


  • framework.jar :应用程序可访问的API

  • services.jar :位于 frameworks / base /下的管理器和系统服务的实现服务

  • libandroid * .so :从本机代码(C / C ++)生成的库,如.cpp文件位于 frameworks / base / core / jni

  • 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.

但是,一般来说,框架内的每个 Android.mk 都会产生于至少一个由 LOCAL_MODULE 变量命名的输出,模块的类型取决于以下include指令:

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)

例如, frameworks / base / cmds 文件夹为其中的每个项目生成一个Java库和一个可执行文件,例如通常用于通过ADB安装应用程序的 pm 命令。在任何情况下,规则是:Java库转到 / system / framework / ,共享库转到 / system / lib / 和可执行文件转到 / system / bin

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.

有关的更多官方信息可以在此处找到Android.mk ,但它没有涵盖Android Build System使用的所有变量和宏,我从AOSP代码本身获得大部分信息。

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.

希望有所帮助。

这篇关于仅替换framework.jar&amp; Android MarshMallow上的相关库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆