android_app_import corrupts APK

528 Views Asked by At

I'm trying to add some prebuilt apps to my AOSP built, using this blueprint:

android_app_import {
    name: "App",
    apk: "App.apk",
    presigned: true,
    dex_preopt: {
        enabled: false,
    },
    privileged: true,
    product_specific: true,
}

...

Two of them work fine, but others don't — the APK are being changed during the build.

Their md5 differ and it looks like the signature is stripped out, because if I pull the APK from the device and try to install it with adb install, it says that INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl476333160.tmp/base.apk: META-INF/APP.SF indicates /data/app/vmdl476333160.tmp/base.apk is signed using APK Signature Scheme v2, but no such signature was found. Signature stripped?

UPD. Found out that someone faced exactly the same issue.

UPD 2. The same, but in this case the solutions don't use soong, and I need soong.

How to fix it?

2

There are 2 best solutions below

1
Yong On

Try to add "preprocessed: true"

android_app_import {
  name: "App",
  apk: "App.apk",
  presigned: true,
  dex_preopt: {
    enabled: false,
  },
  privileged: true,
  product_specific: true,
  preprocessed: true,
}
0
Rajesh On

Use DONT_UNCOMPRESS_PRIV_APPS_DEXS := true in your android.bp file. This will stop decompressing priv-app during build time.