android源码编译笔记--踩坑

2023-05-16

错误:ninja: build stopped: subcommand failed.

解决:

打开 prebuilts/sdk/tools/jack-admin

找到 JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR     $JACK_SERVER_VM_ARGUMENTS -cp $LAUNCHER_JAR $LAUNCHER_NAME"

修改为 JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -Xmx4096m -cp $LAUNCHER_JAR $LAUNCHER_NAME"

重启jack-server

$ ./prebuilts/sdk/tools/jack-admin stop-server 
$ ./prebuilts/sdk/tools/jack-admin start-server
 

make clean这个命令最好少用,不然在Make的时候又是5小时的编译

make clean 命名在修改了art源码的时候需要加入,不然编译出来了system/lib 里面的so不变(fart源码编译)

单独编译system.img 在根目录下source build/envsetup.sh   ,lunch ,make systemimage -j4

ubuntu18.04.5 编译android_10_r33报错:

[100% 47/47] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
out/soong/.bootstrap/bin/soong_build -t -l out/.module_paths/Android.bp.list -b out/soong -n out -d out/soong/build.ninja.d -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja Android.bp
Killed
14:41:13 soong bootstrap failed with: exit status 1

解决:

虚拟机ram不够,分配成16GB和2*4处理器最好,然后swap分区2G加到20G(一般ubuntu 18.04分配的是 2g)

参考:

ubuntu swap分区加大

报错:

ubuntu18.04.5无法安装libesd0-dev

解决:

1 sudo vim /etc/apt/sources.list  //在行尾添加如下两行的内容
2 deb http://us.archive.ubuntu.com/ubuntu/ xenial main universe
3 deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main universe

然后重新更新软件源下载

在进行源码同步的时候,南方最好用中科大的源,北方用清华的源

清华:

https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest

中科大: 

git://mirrors.ustc.edu.cn/aosp/platform/manifest


android 10在配置selinux访问策略文件后,编译报错:

[  4% 3/74] build out/target/product/taimen/obj/ETC/built_plat_sepolicy_intermed
FAILED: out/target/product/taimen/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy
/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -M -C -c 		30 -o out/target/product/taimen/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy out/target/product/taimen/obj/ETC/built_plat_sepolicy_intermediates/base_plat_policy.conf ) && (cat   system/sepolicy/private/technical_debt.cil >> out/target/product/taimen/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy ) && (out/host/linux-x86/bin/secilc -m -M true -G -c 30  out/target/product/taimen/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -o out/target/product/taimen/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy -f /dev/null )"
neverallow check failed at out/target/product/taimen/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy:11640 from system/sepolicy/public/property.te:352
  (neverallow base_typeattr_461 base_typeattr_462 (property_service (set)))
    <root>
    allow at out/target/product/taimen/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy:18299
      (allow system_app mysystem_prop (property_service (set)))
    <root>
    allow at out/target/product/taimen/obj/ETC/built_plat_sepolicy_intermediates/built_plat_sepolicy:18303
      (allow system_app mysystem_prop (property_service (set)))

Failed to generate binary
Failed to build policydb
[  5% 4/74] build out/target/product/taimen/obj/ETC/userdebug_plat_sepolicy.cil_
FAILED: out/target/product/taimen/obj/ETC/userdebug_plat_sepolicy.cil_intermediates/userdebug_plat_sepolicy.cil
/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -M -C -c 		30 -o out/target/product/taimen/obj/ETC/userdebug_plat_sepolicy.cil_intermediates/userdebug_plat_sepolicy.cil.tmp out/target/product/taimen/obj/ETC/userdebug_plat_sepolicy.cil_intermediates/userdebug_plat_policy.conf ) && (cat   system/sepolicy/private/technical_debt.cil   >> out/target/product/taimen/obj/ETC/userdebug_plat_sepolicy.cil_intermediates/userdebug_plat_sepolicy.cil.tmp ) && (out/host/linux-x86/bin/secilc -m -M true -G -c 30  out/target/product/taimen/obj/ETC/userdebug_plat_sepolicy.cil_intermediates/userdebug_plat_sepolicy.cil.tmp -o /dev/null -f /dev/null ) && (mv out/target/product/taimen/obj/ETC/userdebug_plat_sepolicy.cil_intermediates/userdebug_plat_sepolicy.cil.tmp out/target/product/taimen/obj/ETC/userdebug_plat_sepolicy.cil_intermediates/userdebug_plat_sepolicy.cil )"
neverallow check failed at out/target/product/taimen/obj/ETC/userdebug_plat_sepolicy.cil_intermediates/userdebug_plat_sepolicy.cil.tmp:11818 from system/sepolicy/public/property.te:352
  (neverallow base_typeattr_470 base_typeattr_471 (property_service (set)))
    <root>
    allow at out/target/product/taimen/obj/ETC/userdebug_plat_sepolicy.cil_intermediates/userdebug_plat_sepolicy.cil.tmp:18881
      (allow system_app mysystem_prop (property_service (set)))
    <root>
    allow at out/target/product/taimen/obj/ETC/userdebug_plat_sepolicy.cil_intermediates/userdebug_plat_sepolicy.cil.tmp:18885
      (allow system_app mysystem_prop (property_service (set)))

Failed to generate binary
Failed to build policydb
[  6% 5/74] build out/target/product/taimen/obj/ETC/plat_sepolicy.cil_intermedia
FAILED: out/target/product/taimen/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil
/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -M -C -c 		30 -o out/target/product/taimen/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil.tmp out/target/product/taimen/obj/ETC/plat_sepolicy.cil_intermediates/plat_policy.conf ) && (cat   system/sepolicy/private/technical_debt.cil   >> out/target/product/taimen/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil.tmp ) && (out/host/linux-x86/bin/secilc -m -M true -G -c 30  out/target/product/taimen/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil.tmp -o /dev/null -f /dev/null ) && (mv out/target/product/taimen/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil.tmp out/target/product/taimen/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil )"
neverallow check failed at out/target/product/taimen/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil.tmp:11818 from system/sepolicy/public/property.te:352
  (neverallow base_typeattr_470 base_typeattr_471 (property_service (set)))
    <root>
    allow at out/target/product/taimen/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil.tmp:18881
      (allow system_app mysystem_prop (property_service (set)))
    <root>
    allow at out/target/product/taimen/obj/ETC/plat_sepolicy.cil_intermediates/plat_sepolicy.cil.tmp:18885
      (allow system_app mysystem_prop (property_service (set)))

Failed to generate binary
Failed to build policydb
14:53:26 ninja failed with: exit status 1

主要是因为策略冲突了,一边允许一边不允许,所以删除不允许的那部分就行了

解决:

删除system/sepolicy/public/property.te:352中的neverallow策略,就是:

compatible_property_only(`
  # Neverallow coredomain to set vendor properties
  neverallow {
    coredomain
    -init
    -system_writes_vendor_properties_violators
  } {
    property_type
    -apexd_prop
    -audio_prop
    -bluetooth_a2dp_offload_prop
    -bluetooth_audio_hal_prop
    -bluetooth_prop
    -bootloader_boot_reason_prop
    -boottime_prop
    -bpf_progs_loaded_prop
    -config_prop
    -cppreopt_prop
    -ctl_adbd_prop
    -ctl_bootanim_prop
    -ctl_bugreport_prop
    -ctl_console_prop
    -ctl_default_prop
    -ctl_dumpstate_prop
    -ctl_fuse_prop
    -ctl_gsid_prop
    -ctl_interface_restart_prop
    -ctl_interface_start_prop
    -ctl_interface_stop_prop
    -ctl_mdnsd_prop
    -ctl_restart_prop
    -ctl_rildaemon_prop
    -ctl_sigstop_prop
    -ctl_start_prop
    -ctl_stop_prop
    -dalvik_prop
    -debug_prop
    -debuggerd_prop
    -default_prop
    -device_logging_prop
    -dhcp_prop
    -dumpstate_options_prop
    -dumpstate_prop
    -exported2_config_prop
    -exported2_default_prop
    -exported2_radio_prop
    -exported2_system_prop
    -exported2_vold_prop
    -exported3_default_prop
    -exported3_radio_prop
    -exported3_system_prop
    -exported_bluetooth_prop
    -exported_config_prop
    -exported_dalvik_prop
    -exported_default_prop
    -exported_dumpstate_prop
    -exported_ffs_prop
    -exported_fingerprint_prop
    -exported_overlay_prop
    -exported_pm_prop
    -exported_radio_prop
    -exported_secure_prop
    -exported_system_prop
    -exported_system_radio_prop
    -exported_vold_prop
    -exported_wifi_prop
    -extended_core_property_type
    -ffs_prop
    -fingerprint_prop
    -firstboot_prop
    -device_config_activity_manager_native_boot_prop
    -device_config_reset_performed_prop
    -device_config_boot_count_prop
    -device_config_input_native_boot_prop
    -device_config_netd_native_prop
    -device_config_runtime_native_boot_prop
    -device_config_runtime_native_prop
    -device_config_media_native_prop
    -dynamic_system_prop
    -gsid_prop
    -heapprofd_enabled_prop
    -heapprofd_prop
    -hwservicemanager_prop
    -last_boot_reason_prop
    -system_lmk_prop
    -log_prop
    -log_tag_prop
    -logd_prop
    -logpersistd_logging_prop
    -lowpan_prop
    -lpdumpd_prop
    -mmc_prop
    -net_dns_prop
    -net_radio_prop
    -netd_stable_secret_prop
    -nfc_prop
    -overlay_prop
    -pan_result_prop
    -persist_debug_prop
    -persistent_properties_ready_prop
    -pm_prop
    -powerctl_prop
    -radio_prop
    -restorecon_prop
    -safemode_prop
    -serialno_prop
    -shell_prop
    -system_boot_reason_prop
    -system_prop
    -system_radio_prop
    -system_trace_prop
    -test_boot_reason_prop
    -test_harness_prop
    -theme_prop
    -time_prop
    -traced_enabled_prop
    -traced_lazy_prop
    -vendor_default_prop
    -vendor_security_patch_level_prop
    -vold_prop
    -wifi_log_prop
    -wifi_prop
  }:property_service set;
')

修改为:

compatible_property_only(`
  # Neverallow coredomain to set vendor properties
')

然后编译会报错,

SELinux: The following public types were found added to the policy without an entry into the compatibility mapping file(s) found in private/compat/V.v/V.v[.ignore].cil, where V.v is the latest API level.
mysystem_prop
这是因为只在system/sepolicy/public/property.te和 system/sepolicy/prebuilts/api/29.0/public/property.te中修改了,26、27、28中没有修改,需要在/system/sepolicy/private/compat/26.0、/system/sepolicy/private/compat/27.0、/system/sepolicy/private/compat/28.0的28.0.ignore.cil中添加mysystem_prop

/*

[  0% 3/2890] build out/target/product/taimen/obj/ETC/sepolicy_neverallows_inter

FAILED: out/target/product/taimen/obj/ETC/sepolicy_neverallows_intermediates/plat_pub_policy.cil

/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -C -M -c 30 -o out/target/product/taimen/obj/ETC/sepolicy_neverallows_intermediates/plat_pub_policy.cil out/target/product/taimen/obj/ETC/sepolicy_neverallows_intermediates/plat_pub_policy.conf ) && (out/host/linux-x86/bin/build_sepolicy -a out/host/linux-x86/bin filter_out        -f out/target/product/taimen/obj/ETC/sepolicy_neverallows_intermediates/reqd_policy_mask.cil -t out/target/product/taimen/obj/ETC/sepolicy_neverallows_intermediates/plat_pub_policy.cil )"

system/sepolicy/public/file.te:505:ERROR 'syntax error' at token 'fingerprintd' on line 14365:

# /data/system/xsettings/

type frdinject_data_file,file_type,data_file_type,core_data_file_type,mlstrustedobjecttype fingerprintd, domain;

checkpolicy:  error(s) encountered while parsing configuration

[  0% 6/2890] build out/target/product/taimen/obj/ETC/sepolicy_neverallows_inter

FAILED: out/target/product/taimen/obj/ETC/sepolicy_neverallows_intermediates/pub_policy.cil

/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -C -M -c 30 -o out/target/product/taimen/obj/ETC/sepolicy_neverallows_intermediates/pub_policy.cil out/target/product/taimen/obj/ETC/sepolicy_neverallows_intermediates/pub_policy.conf ) && (out/host/linux-x86/bin/build_sepolicy -a out/host/linux-x86/bin filter_out      -f out/target/product/taimen/obj/ETC/sepolicy_neverallows_intermediates/reqd_policy_mask.cil -t out/target/product/taimen/obj/ETC/sepolicy_neverallows_intermediates/pub_policy.cil )"

system/sepolicy/public/file.te:505:ERROR 'syntax error' at token 'fingerprintd' on line 14365:

# /data/system/xsettings/

type frdinject_data_file,file_type,data_file_type,core_data_file_type,mlstrustedobjecttype fingerprintd, domain;

checkpolicy:  error(s) encountered while parsing configuration

17:33:06 ninja failed with: exit status 1

 */

 //语法错误。type frdinject_data_file,file_type,data_file_type,core_data_file_type,mlstrustedobject 少了; 改为 type frdinject_data_file,file_type,data_file_type,core_data_file_type,mlstrustedobject;

报错:

error: Added package android.xfrd [AddedPackage]
Aborting: Found compatibility problems checking the public API against the API in /home/aun/android10-r1/frameworks/base/api/current.txt
-e 
******************************
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 api-stubs-docs-update-current-api

      To submit the revised current.txt to the main Android repository,
      you will need approval.
******************************
加入package没有更新api,在编译之前执行make api-stubs-docs-update-current-api -j4

报错:

原因:添加了函数和cpp、.h文件没有在android.bp中说明

解决:在android.bp中添加:

srcs: [
        "daemon/main.cpp",
        //add start
        "daemon/shell_socket_service.cpp",
        //add end
    ],

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

android源码编译笔记--踩坑 的相关文章

随机推荐

  • 如何解决Unable to parse template "Interface"Error Message;

    Unable to parse template Interface Error Message This Template did not Produce a Java Class or an interface关于这个错误 xff0c
  • inflate函数使用总结

    inflate 两个参数和三个参数的区别 以前使用没有关注过 xff0c 因为觉得没报bug就行了 xff0c 两个三个参数无所谓 xff0c 经过导师提醒 xff0c 决定好好看看源码和相关知识 xff0c 总觉一下区别 xff0c 以免
  • 除了csdn网站打不开,一直刷新等待没反应,其他网站都能正常访问

    DNS错误 自动获取DNS服务器地址 清除DNS缓存信息 ipconfig span class token operator span flushdns 重置winsock 目录设置 netsh winsock reset
  • org.slf4j用法

    org slf4j用法 Scala 1 创建Logger对象 private val logger Logger 61 LoggerFactory getLogger classOf HttpBmlClient 2 打印错误信息 同时抛出异
  • 安装图形界面、VNCserver

    centos7 安装图形界面 xff1a 第一步 xff1a 安装Gnome包 在命令行下 输入下面的命令来安装Gnome包 yumgroupinstall 34 GNOMEDesktop 34 34 GraphicalAdministra
  • MySQL全量、增量备份与恢复的简单方法

    本文主要给大家介绍MySQL全量 增量备份与恢复的简单方法 xff0c 文章内容都是笔者用心摘选和编辑的 xff0c 具有一定的针对性 xff0c 对大家的参考意义还是比较大的 xff0c 下面跟笔者一起了解下MySQL全量 增量备份与恢复
  • windows安装zabbix代理

    一 关闭windows防火墙或者开通10050和10051端口 直接windows关闭防火墙或者在防火墙中放行10050和10051 二 xff0e 下载 安装并修改windows代理 1 下载zabbix agentd包 官网下载地址 x
  • android8.0 Fingerprint 指纹输错5次后亮屏显示错误信息

    当有指纹解锁时 xff0c 会执行AuthenticationClient java gt onAuthenticated 一直在监听解锁行为 64 Override public boolean onAuthenticated int f
  • secureCRT 抓取串口数据

    language 61 34 VBScript 34 interface 61 34 1 0 34 Dim outputFile fout Dim outputPath Dim user outputPath 61 34 D out txt
  • 2022年编程语言热度排行榜来啦,快来看看你学习的语言排第几

    提示 xff1a 文章写完后 xff0c 目录可以自动生成 xff0c 如何生成可参考右边的帮助文档 前言 一直以来 xff0c 编程语言都是程序员非常关注的话题 年末将至 xff0c 是否会有程序员发出疑问 2022 年行业需求最大的编程
  • LibEvent-Demo

    libevent test cpp 定义控制台应用程序的入口点 include 34 stdafx h 34 pragma comment lib 34 ws2 32 lib 34 pragma comment lib 34 wsock32
  • 【数据挖掘】DBSCAN聚类算法(python实现)

    一 python代码 39 39 39 Author Vici date 2020 5 14 39 39 39 import math 39 39 39 Point类 xff0c 记录坐标x xff0c y和点的名字id 39 39 39
  • ubuntu中安装rpm格式的软件包

    ubuntu的软件包格式是deb xff0c 如果要安装rpm的包 xff0c 则要先用alien把rpm转换成deb zhhLinux联盟 sudo apt get install alien alien默认没有安装 xff0c 所以首先
  • SQLite3在windows下的配置(链接VC++或者VS)

    一 SQLite3 简介 SQLite3 是一个开源免费的嵌入式关系数据库 xff0c 它在 2000 年由 D Richard Hipp 发布 xff0c 它不像大型数据库管理系统 xff0c 占用系统大量资源 SQLite3 是用 C
  • 电脑正常联网,提示无法登录微信

    事故起因 xff1a 因为工作需要安装一款软件 xff0c 安装途中提示有风险直接忽略了该风险 后期卸掉该软件 xff0c 然后无法登录微信 QQ easyconnect等软件 xff0c 但是浏览器可以正常访问 登录微信出现的界面是 xf
  • Ubuntu-GNOME 16.04 LTS更换主题

    1 安装gnome shell扩展插件 进入https extensions gnome org 先将gnome安装插件安装到火狐浏览器上 xff0c 而后查找插件 User Themes by fmuellner 如果无法选择比如题头报错
  • 图片服务器搭建 ftp上传http协议读取图片

    怎样在Win7系统中搭建Web服务器 详见百度搭建教程web服务器搭建 web服务器搭建 搭建好服务器以后配置 controller层 span class hljs javadoc 上传头像 span span class hljs an
  • SVM&TSVM&LSA(I)→PLSA(I)→LDA→HDP

    SVM amp TSVM amp LSA I PLSA I LDA HDP SVM xff08 用于监督学习 xff09 参考文章 xff1a SVM xff08 支持向量机 xff09 详解 通俗来讲 xff0c SVM是一种二类分类模型
  • adb源码分析

    ADB是Android debug bridge的缩写 xff0c 它使用PC机可以通过USB或网络与android设备通讯 adb的源码位于system core adb目录下 xff0c 先来看下编译脚本Android mk xff1a
  • android源码编译笔记--踩坑

    错误 xff1a ninja build stopped subcommand failed 解决 xff1a 打开 prebuilts sdk tools jack admin 找到 JACK SERVER COMMAND 61 34 j