[原创]Nexus5 移植OneStep

Posted 疾风剑

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[原创]Nexus5 移植OneStep相关的知识,希望对你有一定的参考价值。

OneStep 简介 https://github.com/SmartisanTech/android

 

One Step 涉及的工程列表:

由于自己已经下载过android的全套源码,移植时采取部分更新的方式进行,具体就是只替换git上 6-7月份之间更新的代码,这部分是onestep改动的地方,其他部分的代码原封不动

 

 替换完直接进行编译,主要遇到只有两个的问题:

1、

搜索build目录下,发现build/core/tasks/check_boot_jars/check_boot_jars.py脚本里CheckJar函数会打印上面的提示

 

参考https://zhidao.baidu.com/question/1387700248427899620.html,检查移植过程,发现package_whitelist.txt 忘记替换了。

 

 问题2:

 报错部分位于:

查找代码,

发现只是实现和调用没有同步更新

新的实现:

 

 移值完成后

 

2017-8-21

近日,重新编译源码,发现突然编译不过去了

make: *** [out/target/common/obj/JAVA_LIBRARIES/colorpicker_intermediates/src/R.stamp] 已放弃 (core dumped)
Warning: AndroidManifest.xml already defines versionCode (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines versionName (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines minSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines targetSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
A/Vector  (23191): [0x7fffcdef3190] itemLocation: index=0, capacity=0, count=0
build/core/static_java_library.mk:125: recipe for target \'out/target/common/obj/JAVA_LIBRARIES/android-opt-datetimepicker_intermediates/src/R.stamp\' failed
make: *** [out/target/common/obj/JAVA_LIBRARIES/android-opt-datetimepicker_intermediates/src/R.stamp] 已放弃 (core dumped)
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
Warning: AndroidManifest.xml already defines versionCode (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines versionName (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines minSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines targetSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
A/Vector  (23193): [0x7ffdcbd4e6f0] itemLocation: index=0, capacity=0, count=0
build/core/static_java_library.mk:125: recipe for target \'out/target/common/obj/JAVA_LIBRARIES/android-opt-timezonepicker_intermediates/src/R.stamp\' failed
make: *** [out/target/common/obj/JAVA_LIBRARIES/android-opt-timezonepicker_intermediates/src/R.stamp] 已放弃 (core dumped)

网上说法一堆, 很多是资源文件没按照规则写导致的,没法解决根本问题

可以看到不合理的地方在已经指定了TARGET_DEVICE 为hammerhead, 为什么编译时变成了common

No private recovery resources for TARGET_DEVICE hammerhead
target R.java/Manifest.java: BasicDreams (out/target/common/obj/APPS/BasicDreams_intermediates/src/R.stamp)
A/Vector  (26926): [0x7fffc3077110] itemLocation: index=0, capacity=0, count=0
build/core/package_internal.mk:243: recipe for target \'out/target/common

 

$(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT) | $(ACP)
    @echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
    @rm -f $@
    @echo "sain begin"
    $(create-resource-java-files)
    @echo "sain end"
    $(hide) for GENERATED_MANIFEST_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \\
                    -name Manifest.java 2> /dev/null`; do \\
        dir=`awk \'/package/{gsub(/\\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}\' $$GENERATED_MANIFEST_FILE`; \\
        mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \\
        $(ACP) -fp $$GENERATED_MANIFEST_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \\
    done;
    $(hide) for GENERATED_R_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \\
                    -name R.java 2> /dev/null`; do \\
        dir=`awk \'/package/{gsub(/\\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}\' $$GENERATED_R_FILE`; \\
        mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \\
        $(ACP) -fp $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \\
            || exit 31; \\
        $(ACP) -fp $$GENERATED_R_FILE $@ || exit 32; \\
    done; \\

 报错变成

target R.java/Manifest.java: BasicDreams (out/target/common/obj/APPS/BasicDreams_intermediates/src/R.stamp)
sain begin
A/Vector  (14796): [0x7ffc1042cd80] itemLocation: index=0, capacity=0, count=0
build/core/package_internal.mk:243: recipe for target \'out/target/common/obj/APPS/BasicDreams_intermediates/src/R.stamp\' failed
make: *** [out/target/common/obj/APPS/BasicDreams_intermediates/src/R.stamp] 已放弃

#### make failed to build some targets (54 seconds) ####

可见 问题出在 $(create-resource-java-files)

 

这个问题最后也没有解决, 删除所有的apps和 framework,重新repo sync也不行(2018年03月11日)

但自己在package新建的app就可以编译通过, 是不是support包导致的呢, 在ide中曾经也碰到过这种问题

以上是关于[原创]Nexus5 移植OneStep的主要内容,如果未能解决你的问题,请参考以下文章

[原创]Nexus5 源码下载编译真机烧录过程记录

锤子OneStep及BigBang使用体验

1分钟让你的App 适配 锤子OneStep

TechRoad_oneStep_0515

Techroad_oneStep_210604

全新的闪念胶囊,OneStep 1.5 以及 BigBang 2.0 更新后的 Smartisan OS 3.6 体验