粉丝朋友在学习我的课程内置应用时候,发现如果在Android 12 S上预制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路径: