I would like to add a pre-built and signed APEX to an AOSP built. I can add the APEX file via the prebuilt_apex
command in the Android.bp
file. The apex is then correctly build and added to the the system partition. However, when attempting to start the Android firmware an error shows, that the system can't find the public key of the APEX file.
Error:
java.lang.IllegalStateException: Unable to parse: com.test.android.telephony.apex
...
Caused by: android.content.pm.PackageParser$PackageParserException: Failed to collect certificates for com.test.android.telephony.apex
...
The error indicated that the certificate (public key) for the prebuilt APEX file cannot be found. So I tried to add a key via the apex_key
command in the Android.bp. However, the official Android documentation does not give any guidance on how to map an APEX key to a prebuilt APEX file and I didn't find any way to map them.
How do I need to add the public key for a prebuilt APEX file?
This is my Android.bp file for the module at the moment.
prebuilt_apex {
name: "com.test.android.telephony",
overrides: [],
arch: {
arm64: {src: "com.test.android.telephony.apex",},
x86_64: {src: "com.test.android.telephony.apex",},},
filename: "com.test.android.telephony.apex",
prefer: true,
installable: true
}
apex_key {
name: "com.test.android.telephony_pubkey",
public_key: "com.test.android.telephony_pubkey.pem",
}