Android 12/13 artifact_path_requirements错误 预制apk/预制bootanimation相关framework实战课程答疑
粉丝朋友在学习我的课程内置应用时候,和bootanimation时候,发现如果在Android 12/13 上预制apk时候发现有编译不过情况,报artifact_path_requirements相关错误这里乍一看估计99%的人都不知道怎么回事,这里其实可以从提示是可以看出来:大概是因为新版本artifact_path_requirements有对预装相关东西进行了规则检测,发现system/a
粉丝朋友在学习我的课程内置应用时候,和bootanimation时候,发现如果在Android 12/13 上预制apk时候发现有编译不过情况,报artifact_path_requirements相关错误
具体错误显示如下:
build/make/core/artifact_path_requirements.mk:26: warning: build/make/target/product/sdk_phone_x86_64.mk produces files inside build/make/target/product/generic_system.mks artifact path requirement.
Offending entries:
system/app/MyApp/MyApp.apk
In file included from build/make/core/main.mk:1383:
build/make/core/artifact_path_requirements.mk:26: error: Build failed.
00:42:13 ckati failed with: exit status 1
这里乍一看估计99%的人都不知道怎么回事,这里其实可以从提示是可以看出来:
大概是因为新版本artifact_path_requirements有对预装相关东西进行了规则检测,发现system/app/MyApp/MyApp.apk这种预制到system/app的情况属于违规了。
那么具体怎么解决呢?
方法一
通过在github寻找到了一些第三方rom维护者也有遇到类似问题,参考他们解决方案,自己这边再消化后,我的修改如下:
diff --git a/envsetup.sh b/envsetup.sh
index 16873095aa..8c4a8c62e6 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -211,7 +211,7 @@ function setpaths()
local targetgccversion=$(get_build_var TARGET_GCC_VERSION)
local targetgccversion2=$(get_build_var 2ND_TARGET_GCC_VERSION)
export TARGET_GCC_VERSION=$targetgccversion
-
+ export DISABLE_ARTIFACT_PATH_REQUIREMENTS="true"
# The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
export ANDROID_TOOLCHAIN=
export ANDROID_TOOLCHAIN_2ND_ARCH=
即build/envsetup.sh 加上export DISABLE_ARTIFACT_PATH_REQUIREMENTS="true"就可以顺利编译通过不再报artifact_path_requirements错误,这里其实就相当于把新版本编译系统中artifact_path_requirements检测关闭就可以
附一下成功图片:
成功apk路径:
方法二:
上面修改方式相对有点暴力,没有细粒度的细分,而是一股气把所有的开放了,也有一种细粒度的方法如下:
diff --git a/target/product/telephony_product.mk b/target/product/telephony_product.mk
index 18374d4b23..7e88206193 100644
--- a/target/product/telephony_product.mk
+++ b/target/product/telephony_product.mk
@@ -20,4 +20,10 @@
# /product packages
PRODUCT_PACKAGES += \
Dialer \
+ MyApp \
ImsServiceEntitlement \
+
+
+PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST +=\
+ system/app/MyApp/MyApp.apk \
里面最重要的一个就是
PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST +=\
system/app/MyApp/MyApp.apk \
在这个PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST加上相关的白名单既可以
bootanimation预制新方法:
原来8.1使用的Android.mk中进行shell直接拷贝到system/media路径下已经不生效
1、bootanimation下面已经没有了相关的Android.mk了
2、哪怕找到可以执行的Android.mk,编译也会提示没有media路径不存在
这里也针对新版本的预制bootanimation.zip进行讲解
修改patch如下
test@test:~/aosp/build/make$ git status
HEAD detached at d0d363fbc2
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: envsetup.sh
modified: target/product/handheld_system_ext.mk
modified: target/product/telephony_product.mk
no changes added to commit (use "git add" and/or "git commit -a")
test@test:~/aosp/build/make$ git diff
diff --git a/envsetup.sh b/envsetup.sh
index be6061d67d..069a9d7d22 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -211,7 +211,7 @@ function setpaths()
local targetgccversion=$(get_build_var TARGET_GCC_VERSION)
local targetgccversion2=$(get_build_var 2ND_TARGET_GCC_VERSION)
export TARGET_GCC_VERSION=$targetgccversion
-
+ export DISABLE_ARTIFACT_PATH_REQUIREMENTS="true"//这里上面有介绍
# The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
export ANDROID_TOOLCHAIN=
export ANDROID_TOOLCHAIN_2ND_ARCH=
diff --git a/target/product/handheld_system_ext.mk b/target/product/handheld_system_ext.mk
index d935fbfddf..9c19ab14cd 100644
--- a/target/product/handheld_system_ext.mk
+++ b/target/product/handheld_system_ext.mk
@@ -19,6 +19,8 @@
# it definitely doesn't belong on other types of devices (if it
# does, use base_system_ext.mk).
$(call inherit-product, $(SRC_TARGET_DIR)/product/media_system_ext.mk)
+PRODUCT_COPY_FILES += \
+ packages/services/Car/car_product/car_ui_portrait/bootanimation/bootanimation.zip:system/media/bootanimation.zip
这里核心就是如下这句
PRODUCT_COPY_FILES += \
packages/services/Car/car_product/car_ui_portrait/bootanimation/bootanimation.zip:system/media/bootanimation.zip
采用这个PRODUCT_COPY_FILES宏,这个方式相对比较标准
更多干货framework课程列表
https://blog.csdn.net/learnframework/article/details/132739059
需要更多资料可以+v(androidframework007)也可以下面公众号
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)