Framework 资源添加时问题整理

          第一次遇到这种问题,所以总结一下我编译过程中遇到的所有问题,希望可以帮到小伙伴们。好了其他的不多说直接展示错误:


<span style="font-size:18px;">Copying: out/target/common/obj/JAVA_LIBRARIES/javax.obex_intermediates/emma_out/lib/classes-jarjar.jar

 out/target/common/obj/PACKAGING/framework_res_id_api.txt:5384: error 17: Field com.android.internal.R.string
.ellipsis <span style="background-color: rgb(255, 255, 51);">has changed value from 17041066 to 17041067</span>

 out/target/common/obj/PACKAGING/framework_res_id_api.txt:5385: error 17: Field com.android.internal.R.string
.ellipsis_two_dots <span style="background-color: rgb(255, 255, 51);">has changed value from 17041067 to 17041068</span>

 out/target/common/obj/PACKAGING/framework_res_id_api.txt:5898: error 17: Field com.android.internal.R.string
.throttle_warning_notification_message <span style="background-color: rgb(255, 255, 51);">has changed value from 17041082 to 17041083</span>

 out/target/common/obj/PACKAGING/framework_res_id_api.txt:5899: error 17: Field com.android.internal.R.string
.throttle_warning_notification_title <span style="background-color: rgb(255, 255, 51);">has changed value from 17041081 to 17041082</span>

 out/target/common/obj/PACKAGING/framework_res_id_api.txt:5900: error 17: Field com.android.internal.R.string
.throttled_notification_message <span style="background-color: rgb(255, 255, 51);">has changed value from 17041084 to 17041085</span>

 out/target/common/obj/PACKAGING/framework_res_id_api.txt:5901: error 17: Field com.android.internal.R.string
.throttled_notification_title <span style="background-color: rgb(255, 255, 51);">has changed value from 17041083 to 17041084</span>

 out/target/common/obj/PACKAGING/framework_res_id_api.txt:5940: error 17: Field com.android.internal.R.string
.use_physical_keyboard <span style="background-color: rgb(255, 255, 51);">has changed value from 17041080 to 17041081</span>

******************************
You have tried to change Android framework-res resource ID. Please fix the errors listed above by 
restoring the changes.
******************************</span>



错误原因:

在framework/base/core/res/res/values/symbol.xml中直接添加 <java-symbol type="string" name="reboot_confirm"  /> 在编译过程中生成了

sources ID 占用了framework api 原来的source ID,于是其他type="string"这一类的 Sources ID都一次+1 所以会报错

我把<java-symbol type="string" name="reboot_confirm"  />放在最后一行也没有作用,(郁闷,本地没有编译好的版本,全编要好长时间才出现错误)


第一次尝试:删除framework/base/core/res/res/values/symbol.xml中的添加

在framework/base/core/res/res/values/public.xml中直接添加 <public type="string" name="reboot_confirm" id="0x10406bd" />

【这里我发表一下我的个人理解:@1、『public 公用的{对我来说无关紧要,这是必要的格式}』

@2、『type="string" 代表在out/target/common/obj/PACKAGING/framework_res_id_api.txt中的类』

@3、『name="reboot_confirm" 添加的资源』

@4、『id="0x10406bd"16进制的source ID』

关于@4这个source ID我说以下我是怎么得来:

我在out/target/common/obj/PACKAGING/framework_res_id_api.txt中搜索R.string{}中source ID最大的一个【这里是十进制的:如17041084】

然后在这个source ID的基础上加1,得到了17041085;又在,window下的计算器转换成16进制添加到public 中的id上

结果:


<span style="font-size:18px;">rget Java: TelephonyProvider (out/target/common/obj/APPS/TelephonyProvider_intermediates/classes)
Checking API: checkpublicapi-last
Checking API: checkpublicapi-current
Checking API: checksystemapi-last
out/target/common/obj/PACKAGING/public_api.txt:1815: error 5: Added public field android.R.string.reboot_confirm

******************************
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: *** [out/target/common/obj/PACKAGING/checkpublicapi-current-timestamp] Error 38
make: *** Waiting for unfinished jobs....
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

#### make failed to build some targets (16:29 (mm:ss)) ####</span>

对的又出现了错误!!!!!!!!


不过这个错误比较好,它给我们提示了,让我们怎么去修改,才是正确的方式!


于是我就在我的:

<!--@hide  you can ,follow me-->

<public type="string" name="reboot_confirm" id="0x10406bd" />

添加了个@hide;这个@hide有什么用呢??????=========》加了这个@hide后,在out/target/common/obj/PACKAGING/framework_res_id_api.txt文件中你就

找不到reboot_confirm像这个  public static final class R.string {
    ctor public R.string();
    field public static final int VideoView_error_button = 17039376; // 0x1040010  【加了@hide就看不见了,也就不会报上面第一个错误了】


自己编译OK---------Very Good!!!!






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值