5

I have decompiled APK using apktool d demoapp.apk then compiling apk using apktool b demoapp.apk but at compile time it throws the error

brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1):

Here No resource identifier found for attribute preserveLegacyExternalStorage in package android

The same error appears for requestLegacyExternalStorage as well

Vishnu
  • 663
  • 3
  • 7
  • 24
Sameer Jani
  • 1,192
  • 9
  • 16

3 Answers3

3

If you just want to modify its source before recompile it (resource will not be modified), use -r flag when decompile the apk. I have the same problem, and always get unknown resource problem when recompile it. It solve when I use -r flag when decompile the apk.

# apktool -r d demo.apk
RizaPN
  • 31
  • 2
1

You should compile against SDK 29 and maybe use the most recent build tools for aapt to know this attribute.

Bogdan Lonchuk
  • 209
  • 2
  • 11
0

If nothing helps, the following undocumented command may help (see https://github.com/iBotPeaches/Apktool/issues/1842#issuecomment-522616705):

apktool empty-framework-dir

Run it then try to re-build apk again

apktool b example.apk.dir example.apk

Other things to try:

  1. Upgrade apktool: https://ibotpeaches.github.io/Apktool/install/
  2. Ignore resources with -r flag if you don't need them (e.g. you only need to modify the source code):
apktool -r d example.apk
Alexander Fadeev
  • 2,110
  • 14
  • 16