Error: No resource identifier found for attribute `requestLegacyExternalStorage` and `preserveLegacyExternalStorage` in package `android`

Viewed 3961

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

3 Answers

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

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

Related