Android 8 个关于预构建 .apk 文件的 AOSP 构建问题

Android 8 AOSP build question on prebuild .apk files

我正在开发 uses/will 使用 Android8 的嵌入式系统。迄今为止,开发已在 Android 7.1.1 上进行——参考板的供应商仅支持这两个。

在 Android 7.1.1 中,我们将 .apk 文件从我们的存储库复制到 运行 系统,如下所示:

PRODUCT_COPY_FILES += foo.apk:root/foo.apk

(或类似的。)Android 8.

完全不允许这样做

因此,从少数 google 获得 AOSP 信息而不是有关 Android 手机的用户信息的点击中,我们正在尝试这样做(在 external/foo/Android.mk 中):

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := foo 
LOCAL_SRC_FILES := foo.apk 
LOCAL_MODULE_CLASS := APPS
LOCAL_CERTIFICATE := PRESIGNED

LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)

include $(BUILD_PREBUILT)

...构建中没有任何人工痕迹!

所以,三个问题:

  1. 我做的对吗?
  2. 如何打开 $(info foo) 消息?它们在我们的 7.1.1 环境中默认打开,但在 8.
  3. 我们的指南由 Karim Yaghmour 嵌入Android。有更新的指南吗?

谢谢!

编辑:为了回答下面的问题,我将尝试添加完整的 "make foo" 输出。请注意,这主要是发行版的样板文件,根据参考板制造商的修改,总是吐出:

including device/asus/fugu/vendorsetup.sh
including device/fsl/imx6/vendorsetup.sh
including device/fsl/imx7/vendorsetup.sh
including device/fsl/imx8/vendorsetup.sh
including device/generic/car/car-arm64/vendorsetup.sh
including device/generic/car/car-armv7-a-neon/vendorsetup.sh
including device/generic/car/car-x86/vendorsetup.sh
including device/generic/car/car-x86_64/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-mips64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/google/dragon/vendorsetup.sh
including device/google/marlin/vendorsetup.sh
including device/google/muskie/vendorsetup.sh
including device/google/taimen/vendorsetup.sh
including device/huawei/angler/vendorsetup.sh
including device/lge/bullhead/vendorsetup.sh
including device/linaro/hikey/vendorsetup.sh
including sdk/bash_completion/adb.bash
Setup lunch pioneer_hw1-eng

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=8.0.0
TARGET_PRODUCT=pioneer_hw1
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_PLATFORM_VERSION=OPD1
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a9
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.15.0-50-generic-x86_64-with-Ubuntu-16.04-xenial
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=1.0.0-rfp-rc4
OUT_DIR=out
AUX_OS_VARIANT_LIST=
============================================
Building with -j16 ...
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=8.0.0
TARGET_PRODUCT=pioneer_hw1
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a9
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.15.0-50-generic-x86_64-with-Ubuntu-16.04-xenial
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=1.0.0-rfp-rc4
OUT_DIR=out
============================================
[2/2] bootstrap out/soong/.minibootstrap/build.ninja.in
[1/2] out/soong/.bootstrap/bin/minibp out/soong/.minibootstrap/build.ninja.in
ninja: no work to do.
[2/3] glob device/*/*/Android.bp
ninja: no work to do.
device/fsl/imx6/pioneer_hw1.mk was modified, regenerating...

cts/hostsidetests/os/test-apps/StaticSharedNativeLibProvider/Android.mk:23: warning: FindEmulator: find: `cts/hostsidetests/os/test-apps/StaticSharedNativeLibProvider/src': No such file or directory
cts/hostsidetests/os/test-apps/StaticSharedNativeLibProvider1/Android.mk:23: warning: FindEmulator: find: `cts/hostsidetests/os/test-apps/StaticSharedNativeLibProvider1/src': No such file or directory

./system/sepolicy/Android.mk:107: warning: BOARD_SEPOLICY_VERS not specified, assuming current platform version

No private recovery resources for TARGET_DEVICE pioneer_hw1
platform_testing/build/tasks/tests/instrumentation_metric_test_list.mk: warning: continuous_instrumentation_metric_tests: Unknown installed file for module perf-setup.sh 
platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module RecyclerViewTests 
platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module SettingsFunctionalTests 
platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module LauncherFunctionalTests 
platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module EmergencyInfoTests 
platform_testing/build/tasks/tests/native_metric_test_list.mk: warning: continuous_native_metric_tests: Unknown installed file for module perf-setup.sh 
test/vts/tools/build/tasks/vts_package.mk:222: warning: FindEmulator: cd: vendor/google_vts/testcases: No such file or directory
test/vts/tools/build/tasks/vts_package.mk:222: warning: FindEmulator: cd: vendor/google_vts/testcases: No such file or directory
test/vts/tools/build/tasks/vts_package.mk:222: warning: FindEmulator: cd: vendor/google_vts/testcases: No such file or directory
./test/vts/utils/python/archive/Android.mk:28: warning: overriding commands for target `default'
./test/vts/runners/host/tcp_server/Android.mk:19: warning: ignoring old commands for target `default'
build/core/Makefile:34: warning: overriding commands for target `out/target/product/pioneer_hw1/root/init.rc'
build/core/base_rules.mk:378: warning: ignoring old commands for target `out/target/product/pioneer_hw1/root/init.rc'
[ 66% 2/3] glob device/*/*/Android.bp
ninja: error: '.apk', needed by 'device_controller_all_targets', missing and no known rule to make it
16:34:13 ninja failed with: exit status 1
build/core/main.mk:21: recipe for target 'run_soong_ui' failed
make: *** [run_soong_ui] Error 1

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

编辑 2:编辑 2:在控制器名称后加上 space 后,我得到了 显着 不同的结果,但仍然没有构建:

including device/asus/fugu/vendorsetup.sh
including device/fsl/imx6/vendorsetup.sh
including device/fsl/imx7/vendorsetup.sh
including device/fsl/imx8/vendorsetup.sh
including device/generic/car/car-arm64/vendorsetup.sh
including device/generic/car/car-armv7-a-neon/vendorsetup.sh
including device/generic/car/car-x86/vendorsetup.sh
including device/generic/car/car-x86_64/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-mips64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/google/dragon/vendorsetup.sh
including device/google/marlin/vendorsetup.sh
including device/google/muskie/vendorsetup.sh
including device/google/taimen/vendorsetup.sh
including device/huawei/angler/vendorsetup.sh
including device/lge/bullhead/vendorsetup.sh
including device/linaro/hikey/vendorsetup.sh
including sdk/bash_completion/adb.bash
Setup lunch pioneer_hw1-eng

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=8.0.0
TARGET_PRODUCT=pioneer_hw1
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_PLATFORM_VERSION=OPD1
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a9
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.15.0-50-generic-x86_64-with-Ubuntu-16.04-xenial
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=1.0.0-rfp-rc4
OUT_DIR=out
AUX_OS_VARIANT_LIST=
============================================
Building with -j16 ...
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=8.0.0
TARGET_PRODUCT=pioneer_hw1
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a9
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.15.0-50-generic-x86_64-with-Ubuntu-16.04-xenial
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=1.0.0-rfp-rc4
OUT_DIR=out
============================================
[2/2] bootstrap out/soong/.minibootstrap/build.ninja.in
[2/2] bootstrap out/soong/.minibootstrap/build.ninja.in
ninja: no work to do.
[3/4] glob external/*/Android.bp
ninja: no work to do.
device/fsl/imx6/pioneer_hw1.mk was modified, regenerating...

cts/hostsidetests/os/test-apps/StaticSharedNativeLibProvider/Android.mk:23: warning: FindEmulator: find: `cts/hostsidetests/os/test-apps/StaticSharedNativeLibProvider/src': No such file or directory
cts/hostsidetests/os/test-apps/StaticSharedNativeLibProvider1/Android.mk:23: warning: FindEmulator: find: `cts/hostsidetests/os/test-apps/StaticSharedNativeLibProvider1/src': No such file or directory

./system/sepolicy/Android.mk:107: warning: BOARD_SEPOLICY_VERS not specified, assuming current platform version

No private recovery resources for TARGET_DEVICE pioneer_hw1
platform_testing/build/tasks/tests/instrumentation_metric_test_list.mk: warning: continuous_instrumentation_metric_tests: Unknown installed file for module perf-setup.sh 
platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module RecyclerViewTests 
platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module SettingsFunctionalTests 
platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module LauncherFunctionalTests 
platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module EmergencyInfoTests 
platform_testing/build/tasks/tests/native_metric_test_list.mk: warning: continuous_native_metric_tests: Unknown installed file for module perf-setup.sh 
test/vts/tools/build/tasks/vts_package.mk:222: warning: FindEmulator: cd: vendor/google_vts/testcases: No such file or directory
test/vts/tools/build/tasks/vts_package.mk:222: warning: FindEmulator: cd: vendor/google_vts/testcases: No such file or directory
test/vts/tools/build/tasks/vts_package.mk:222: warning: FindEmulator: cd: vendor/google_vts/testcases: No such file or directory
./test/vts/utils/python/archive/Android.mk:28: warning: overriding commands for target `default'
./test/vts/runners/host/tcp_server/Android.mk:19: warning: ignoring old commands for target `default'
build/core/Makefile:34: warning: overriding commands for target `out/target/product/pioneer_hw1/root/init.rc'
build/core/base_rules.mk:378: warning: ignoring old commands for target `out/target/product/pioneer_hw1/root/init.rc'
[ 75% 3/4] glob external/*/Android.bp
ninja: error: '/controller.apk', needed by 'out/target/product/pioneer_hw1/obj/APPS/controller_intermediates/controller.apk', missing and no known rule to make it
15:43:19 ninja failed with: exit status 1
build/core/main.mk:21: recipe for target 'run_soong_ui' failed
make: *** [run_soong_ui] Error 1

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

将您的模块附加到设备 makefile 中的 PRODUCT_PACKAGES,例如:

PRODUCT_PACKAGES += \
    foo

确保您的模块 foodevice.mk 文件的一部分(例如 device/moto/shamu/device.mk)。

PRODUCT_PACKAGES += \
    foo

这将在您的 system/app 文件夹中生成 apk。下面的标志会将您的应用程序带到 system/priv-app 文件夹。

LOCAL_PRIVILEGED_MODULE := true

您还可以将 apk 路径移动到供应商分区(vendor/app)。

LOCAL_MODULE_PATH   := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)/app

注意打错字了 $(COMMON_ANDROID_PACKAGE_SUFFIIX) 应该是 $(COMMON_ANDROID_PACKAGE_SUFFIX).

还要确保 external/foo/Android.mk

每行末尾没有多余的空格 space