Android 8 AOSP在预构建.apk文件上的构建问题

时间:2019-05-22 20:16:37

标签: android android-source build-system

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

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

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

(或类似之类。)Android 8完全不允许这样做。

因此,从获得我有关AOSP信息而不是有关Android手机用户信息的少量Google热门信息中,我们正在尝试这样做(在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_SUFFIIX)

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) ####

3 个答案:

答案 0 :(得分:0)

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

PRODUCT_PACKAGES += \
    foo

答案 1 :(得分:0)

确保模块 foo device.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

答案 2 :(得分:0)

请小心输入错误 $(COMMON_ANDROID_PACKAGE_SUFFIIX)应该是$(COMMON_ANDROID_PACKAGE_SUFFIX)

还要确保在external / foo / Android.mk每行的末尾没有多余的空格