chriswoope / resign-android-image

Resign Android OS (esp. GrapheneOS) images with your signing keys and add ADB root and other modifications
MIT License
91 stars 6 forks source link

ERROR: Failed to obtain minSdkVersion: aapt2 return code 1: #9

Open paranoyed opened 2 years ago

paranoyed commented 2 years ago

Hi,

first of, thank you for creating this project, it sounds very promising!

I have been trying to get this to work, but I'm getting stuck at different messages. A few I was able to resolve, but now I'm stuck on this.

Even when I try building for different devices, I get stuck on this.

I even cleaned the workspace a few times, does not change the following error.

Is there maybe something missing in my setup?

Setup: Debian 11 VM

Command: /resign-android-image workspace ./keys grapheneos sunfish 2022071100 --ota --factory-image --adb-root --factory-zip --replace-boot --allowbackup --adb-backup

When building for sunfish for some reason you need to execute this first: mkdir -p workspace/out_resign/target_files_extracted/BOOT else the same problems occurs as described in #6

I am unsure why the output prints tee: workspace/out_resign/sign_target_files.txt: No such file or directory in the beginning. Creating the file does not help either.

After a while, I get the following error:

2022-07-13 14:37:01 - sign_target_files_apks.py - WARNING : Failed to find com.android.adbd.apex in target_files; Ignored
2022-07-13 14:37:01 - sign_target_files_apks.py - WARNING : Failed to find com.android.media.swcodec.apex in target_files; Ignored
2022-07-13 14:37:01 - sign_target_files_apks.py - WARNING : Failed to find com.android.runtime.apex in target_files; Ignored
2022-07-13 14:37:01 - sign_target_files_apks.py - WARNING : Failed to find com.android.resolv.apex in target_files; Ignored
2022-07-13 14:37:01 - sign_target_files_apks.py - WARNING : Failed to find com.android.vndk.current.apex in target_files; Ignored
2022-07-13 14:37:01 - sign_target_files_apks.py - WARNING : Failed to find com.android.appsearch.apex in target_files; Ignored
2022-07-13 14:37:01 - sign_target_files_apks.py - WARNING : Failed to find com.android.permission.apex in target_files; Ignored
Rewriting PRODUCT/etc/selinux/product_mac_permissions.xml with new keys.
Rewriting PRODUCT/etc/build.prop:
NOT signing: Camera.apk
        (skipped due to special cert string)
    signing: PhotoTable.apk                                                                                (keys/releasekey)
    signing: Calendar.apk                                                                                  (keys/releasekey)
NOT signing: TrichromeLibrary.apk
        (skipped due to special cert string)
    signing: ModuleMetadata.apk                                                                            (keys/releasekey)
NOT signing: TrichromeChrome.apk
        (skipped due to special cert string)
NOT signing: PdfViewer.apk
        (skipped due to special cert string)
    signing: messaging.apk                                                                                 (keys/releasekey)
NOT signing: TrichromeWebView.apk
        (skipped due to special cert string)
    signing: LatinIME.apk                                                                                  (keys/shared)
NOT signing: Auditor.apk
        (skipped due to special cert string)
    signing: Music.apk                                                                                     (keys/releasekey)
    signing: QuickSearchBox.apk                                                                            (keys/shared)
    signing: ExactCalculator.apk                                                                           (keys/releasekey)
    signing: xdivert.apk                                                                                   (keys/platform)
    signing: DefaultThemesStub.apk                                                                         (keys/releasekey)
    signing: DeskClock.apk                                                                                 (keys/releasekey)
    signing: Gallery2.apk                                                                                  (keys/releasekey)
    signing: com.android.traceur.auto_generated_rro_product_adevtool__.apk                                 (keys/releasekey)
    signing: com.android.phone.auto_generated_rro_product_adevtool__.apk                                   (keys/releasekey)
    signing: SettingsOverlayG025M.apk                                                                      (keys/releasekey)
    signing: NavigationBarModeGesturalOverlayExtraWideBack.apk                                             (keys/releasekey)
    signing: com.android.settings.auto_generated_rro_product_adevtool__.apk                                (keys/releasekey)
    signing: DisplayCutoutEmulationHoleOverlay.apk                                                         (keys/releasekey)
    signing: NavigationBarModeGesturalOverlayNarrowBack.apk                                                (keys/releasekey)
    signing: NavigationBarMode2ButtonOverlay.apk                                                           (keys/releasekey)
    signing: com.android.server.telecom.auto_generated_rro_product_adevtool__.apk                          (keys/releasekey)
    signing: DisplayCutoutEmulationDoubleOverlay.apk                                                       (keys/releasekey)
    signing: android.auto_generated_rro_product_adevtool__.apk                                             (keys/releasekey)
    signing: DisplayCutoutEmulationNarrowOverlay.apk                                                       (keys/releasekey)
    signing: DisplayCutoutEmulationWideOverlay.apk                                                         (keys/releasekey)
    signing: SettingsOverlayG025J.apk                                                                      (keys/releasekey)
    signing: OneHandedModeGesturalOverlay.apk                                                              (keys/releasekey)
    signing: WifiOverlay.apk                                                                               (keys/releasekey)
    signing: NavigationBarMode3ButtonOverlay.apk                                                           (keys/releasekey)
    signing: com.android.systemui.auto_generated_rro_product_adevtool__.apk                                (keys/releasekey)
    signing: NavigationBarModeGesturalOverlayWideBack.apk                                                  (keys/releasekey)
    signing: DisplayCutoutEmulationTallOverlay.apk                                                         (keys/releasekey)
    signing: DisplayCutoutEmulationCornerOverlay.apk                                                       (keys/releasekey)
    signing: com.android.networkstack.tethering__TetheringConfig.auto_generated_rro_product_adevtool__.apk (keys/releasekey)
    signing: FontNotoSerifSourceOverlay.apk                                                                (keys/releasekey)
    signing: ConnectivityOverlay.apk                                                                       (keys/releasekey)
    signing: DisplayCutoutEmulationWaterfallOverlay.apk                                                    (keys/releasekey)
    signing: NoCutoutOverlay.apk                                                                           (keys/releasekey)
    signing: NavigationBarModeGesturalOverlay.apk                                                          (keys/releasekey)
    signing: SettingsOverlayG025N.apk                                                                      (keys/releasekey)
    signing: SettingsIntelligence.apk                                                                      (keys/releasekey)
    signing: ImsServiceEntitlement.apk                                                                     (keys/releasekey)
    signing: OneTimeInitializer.apk                                                                        (keys/releasekey)
    signing: Dialer.apk                                                                                    (keys/shared)
    signing: EuiccGoogle.apk                                                                               (keys/platform)
NOT signing: Apps.apk
        (skipped due to special cert string)
    signing: Contacts.apk                                                                                  (keys/shared)
    signing: PermissionController.apk                                                                      (keys/platform)
    signing: ExtServices.apk                                                                               (keys/platform)
    signing: OsuLogin.apk                                                                                  (keys/releasekey)
    signing: ServiceWifiResources.apk                                                                      (keys/releasekey)
    signing: Tethering.apk                                                                                 (keys/networkstack)
    signing: ServiceConnectivityResources.apk                                                              (keys/releasekey)
    signing: MediaProvider.apk                                                                             (keys/media)
    signing: CellBroadcastApp.apk                                                                          (keys/networkstack)
    signing: CellBroadcastServiceModule.apk                                                                (keys/networkstack)
    signing: framework-res.apk                                                                             (keys/platform)

   ERROR: Failed to obtain minSdkVersion: aapt2 return code 1:

/tmp/tmpFH3R6j_framework-res.apk: error: failed to find resource entry for staged  resource ID 0x01fe0000.

Traceback (most recent call last):
  File "/home/user/.resign-android-image/otatools/bin/sign_target_files_apks/internal/stdlib/runpy.py", line 174, in _run_module_as_main
  File "/home/user/.resign-android-image/otatools/bin/sign_target_files_apks/internal/stdlib/runpy.py", line 72, in _run_code
  File "/home/user/.resign-android-image/otatools/bin/sign_target_files_apks/__main__.py", line 12, in <module>
  File "/home/user/.resign-android-image/otatools/bin/sign_target_files_apks/internal/stdlib/runpy.py", line 174, in _run_module_as_main
  File "/home/user/.resign-android-image/otatools/bin/sign_target_files_apks/internal/stdlib/runpy.py", line 72, in _run_code
  File "/home/user/.resign-android-image/otatools/bin/sign_target_files_apks/sign_target_files_apks.py", line 1401, in <module>
  File "/home/user/.resign-android-image/otatools/bin/sign_target_files_apks/sign_target_files_apks.py", line 1382, in main
  File "/home/user/.resign-android-image/otatools/bin/sign_target_files_apks/sign_target_files_apks.py", line 547, in ProcessTargetFiles
  File "/home/user/.resign-android-image/otatools/bin/sign_target_files_apks/sign_target_files_apks.py", line 464, in SignApk
  File "/home/user/.resign-android-image/otatools/bin/sign_target_files_apks/common.py", line 2280, in SignFile
  File "/home/user/.resign-android-image/otatools/bin/sign_target_files_apks/common.py", line 2228, in GetMinSdkVersionInt
  File "/home/user/.resign-android-image/otatools/bin/sign_target_files_apks/common.py", line 2203, in GetMinSdkVersion
common.ExternalError: Failed to obtain minSdkVersion: aapt2 return code 1:

/tmp/tmpFH3R6j_framework-res.apk: error: failed to find resource entry for staged  resource ID 0x01fe0000.

grep: workspace/out_resign/sign_target_files.txt: No such file or directory
Failed to run: go workspace/out_resign/sign_target_files.yTWGfy.tmp workspace/out_resign/target_files_signed.zip.y1K1GM.tmp
Failed to run: make_target_files_signed_zip workspace/out_resign/target_files_signed.zip.y1K1GM.tmp
Failed to run: make_target_files_signed workspace/out_resign/target_files_signed.NItANr.tmp
Failed to run: make_target_files_base workspace/out_resign/target_files.Pav1gX.tmp
Failed to run: make_target_files_zip workspace/out_resign/target_files.zip.Kyj9lH.tmp
user@Android-Signer:~/resign-android-image$

Any advice is very much appreciated!

peterjanbalkenende commented 1 year ago

It seems that specifying the full paths of the key directory solves this issue. Issue #21 is a new problem though.