Android Make Update-api 方法
·
目录
SOC : Rk3288Android Version : 8.1
SOC : Rk3566Android Version : 11
SOC : Rk3288
Android Version : 8.1
众所周知,当修改到framework变量时,需要make update-api.
- 修改/新增 framework 中的 非hide 变量.
--- a/frameworks/base/core/java/android/os/TestApi.java +++ b/frameworks/base/core/java/android/os/TestApi.java @@ -10,8 +10,8 @@ public class TestApi{ private static final String TAG="TestApi"; - public static final int DEMOAPI= 11; + public static final int DEMOAPI= 1001; -
如下为编译报错信息,提示有两条路.
①:将修改/增加的变量设置为 @hide.
②:就是执行 make update-api 方法.****************************** You have tried to change the API from what has been previously approved. To make these errors go away, you have two choices: 1) You can add "@hide" javadoc comments to the methods, etc. listed in the errors above. 2) You can update current.txt by executing the following command: make update-api To submit the revised current.txt to the main Android repository, you will need approval. ****************************** -
执行 make update-api 后生成的文件.
diff --git a/frameworks/base/api/current.txt b/frameworks/base/api/current.txt index 58ff4ec7ef..1fac5a78cd 100644 --- a/frameworks/base/api/current.txt +++ b/frameworks/base/api/current.txt @@ -31797,8 +31797,8 @@ package android.os { ctor public TestApi(); method public static java.lang.String readValue(int, int); method public static int writeValue(java.lang.String, int); - field public static final int DEMOAPI= 11; // 0xb + field public static final int DEMOAPI= 1001; // 0x3e9 } public abstract class VibrationEffect implements android.os.Parcelable { diff --git a/frameworks/base/api/system-current.txt b/frameworks/base/api/system-current.txt index 27d71d78da..a181278a9b 100644 --- a/frameworks/base/api/system-current.txt +++ b/frameworks/base/api/system-current.txt @@ -34649,8 +34649,8 @@ package android.os { ctor public TestApi(); method public static java.lang.String readValue(int, int); method public static int writeValue(java.lang.String, int); - field public static final int DEMOAPI= 11; // 0xb + field public static final int DEMOAPI= 1001; // 0x3e9 } public abstract class VibrationEffect implements android.os.Parcelable { diff --git a/frameworks/base/api/test-current.txt b/frameworks/base/api/test-current.txt index fc49a108c0..45d652678b 100644 --- a/frameworks/base/api/test-current.txt +++ b/frameworks/base/api/test-current.txt @@ -31983,8 +31983,8 @@ package android.os { ctor public TestApi(); method public static java.lang.String readValue(int, int); method public static int writeValue(java.lang.String, int); - field public static final int DEMOAPI= 11; // 0xb + field public static final int DEMOAPI= 1001; // 0x3e9 } -
无论使用 @hide 方式还是 make update-api 方式,凡有用到此变量的第三APP就要重载新编译的framework.jar 即可正常使用.
SOC : Rk3566
Android Version : 11
使用场景:工作原因,需要修改Framework中非 hide 的变量.
固有思维:改变Framework需要使用 make update-api指令即可.但是出现以下的错误信息:
******************************
You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:
1. You can add '@hide' javadoc comments (and remove @SystemApi/@TestApi/etc)
to the new methods, etc. shown in the above diff.
2. You can update current.txt and/or removed.txt by executing the following command:
make api-stubs-docs-non-updatable-update-current-api
To submit the revised current.txt to the main Android repository,
you will need approval.
******************************
此方法依然有两个解决方向:
① @Hide 标注为内部.
② 使用 make api-stubs-docs-non-updatable-update-current-api.
问题来了,单单使用 make api-stubs-docs-non-updatable-update-current-api 无效,仍然报错,错误信息如下:
******************************
You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:
1. You can add '@hide' javadoc comments (and remove @SystemApi/@TestApi/etc)
to the new methods, etc. shown in the above diff.
2. You can update current.txt and/or removed.txt by executing the following command:
make api-stubs-docs-update-current-api
To submit the revised current.txt to the main Android repository,
you will need approval.
******************************
继续输入 make api-stubs-docs-update-current-api 生效.
更多推荐




所有评论(0)